int t_day(int month, int *box, int day) {
  int mst;
  switch (month) {
  case 1:
    mst = 31;
    break;
  case 2:
    mst = 29;
    break;
  case 3:
    mst = 31;
    break;
  case 4:
    mst = 30;
    break;
  case 5:
    mst = 31;
    break;
  case 6:
    mst = 30;
    break;
  case 7:
    mst = 31;
    break;
  case 8:
    mst = 31;
    break;
  case 9:
    mst = 30;
    break;
  case 10:
    mst = 31;
    break;
  case 11:
    mst = 30;
    break;
  case 12:
    mst = 31;
    break;
  }
  if (day >= 1 && day <= mst) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<t_day>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xb,%eax
ja     11c2 <t_day+0xc2>
mov    -0x20(%rbp),%rax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1f,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1d,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1f,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1e,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1f,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1e,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1f,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1f,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1e,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1f,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1e,-0x18(%rbp)
jmp    11c2 <t_day+0xc2>
movl   $0x1f,-0x18(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     11e4 <t_day+0xe4>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11e4 <t_day+0xe4>
movl   $0x1,-0x4(%rbp)
jmp    11eb <t_day+0xeb>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_day>:
add    $0xfffffffe,%edi
mov    $0x1f,%eax
cmp    $0x9,%edi
ja     111a <t_day+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
test   %edx,%edx
setg   %cl
cmp    %edx,%eax
setge  %al
and    %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @t_day(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%9 = load i32, i32* %5
switch i32 %9, label %22 [
i32 1, label %10
i32 2, label %11
i32 3, label %12
i32 4, label %13
i32 5, label %14
i32 6, label %15
i32 7, label %16
i32 8, label %17
i32 9, label %18
i32 10, label %19
i32 11, label %20
i32 12, label %21
]
10: ; preds = %3
store i32 31, i32* %8
br label %22
11: ; preds = %3
store i32 29, i32* %8
br label %22
12: ; preds = %3
store i32 31, i32* %8
br label %22
13: ; preds = %3
store i32 30, i32* %8
br label %22
14: ; preds = %3
store i32 31, i32* %8
br label %22
15: ; preds = %3
store i32 30, i32* %8
br label %22
16: ; preds = %3
store i32 31, i32* %8
br label %22
17: ; preds = %3
store i32 31, i32* %8
br label %22
18: ; preds = %3
store i32 30, i32* %8
br label %22
19: ; preds = %3
store i32 31, i32* %8
br label %22
20: ; preds = %3
store i32 30, i32* %8
br label %22
21: ; preds = %3
store i32 31, i32* %8
br label %22
22: ; preds = %3, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10
%23 = load i32, i32* %7
%24 = icmp sge i32 %23, 1
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i32, i32* %7
%27 = load i32, i32* %8
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 1, i32* %4
br label %31
30: ; preds = %25, %22
store i32 0, i32* %4
br label %31
31: ; preds = %30, %29
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
@switch.table.t_day = [10 x i32] [i32 29, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30]
define i32 @t_day(i32 %0, i32* nocapture readnone %1, i32 %2) {
%4 = add i32 %0, -2
%5 = icmp ult i32 %4, 10
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds [10 x i32], [10 x i32]* @switch.table.t_day, i64 0, i64 %7
%9 = load i32, i32* %8
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ 31, %3 ], [ %9, %6 ]
%12 = icmp sgt i32 %2, 0
%13 = icmp sge i32 %11, %2
%14 = and i1 %12, %13
%15 = zext i1 %14 to i32
ret i32 %15
}