#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int month, days;
  printf("Input a month: ");
  scanf("%d", &month);
  switch (month) {
  case 1:
    days = 31;
    break;
  case 2:
    days = 28;
    break;
  case 3:
    days = 31;
    break;
  case 4:
    days = 30;
    break;
  case 5:
    days = 31;
    break;
  case 6:
    days = 30;
    break;
  case 7:
    days = 31;
    break;
  case 8:
    days = 31;
    break;
  case 9:
    days = 30;
    break;
  case 10:
    days = 31;
    break;
  case 11:
    days = 30;
    break;
  case 12:
    days = 31;
    break;
  default:
    printf("wrong month");
    break;
  }
  if (month >= 1 && month <= 12)
    printf("month %d has %d days", month, days);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xb,%eax
ja     1206 <main+0xe6>
mov    -0x18(%rbp),%rax
lea    0xe93(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1f,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1c,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1f,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1e,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1f,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1e,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1f,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1f,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1e,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1f,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1e,-0xc(%rbp)
jmp    1214 <main+0xf4>
movl   $0x1f,-0xc(%rbp)
jmp    1214 <main+0xf4>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     123c <main+0x11c>
cmpl   $0xc,-0x8(%rbp)
jg     123c <main+0x11c>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf0a(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    -0x1(%rsi),%eax
cmp    $0xb,%eax
ja     1187 <main+0x67>
mov    $0x1c,%edx
lea    0xea8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x1(%rsi),%eax
mov    $0x1f,%edx
cmp    $0xb,%eax
jbe    1175 <main+0x55>
jmp    1183 <main+0x63>
mov    $0x1e,%edx
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
jmp    1161 <main+0x41>

LLVM IR (-O0):
@.str = [16 x i8] c"Input a month: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"wrong month\00"
@.str.3 = [21 x i8] c"month %d has %d days\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
switch i32 %6, label %19 [
i32 1, label %7
i32 2, label %8
i32 3, label %9
i32 4, label %10
i32 5, label %11
i32 6, label %12
i32 7, label %13
i32 8, label %14
i32 9, label %15
i32 10, label %16
i32 11, label %17
i32 12, label %18
]
7: ; preds = %0
store i32 31, i32* %3
br label %21
8: ; preds = %0
store i32 28, i32* %3
br label %21
9: ; preds = %0
store i32 31, i32* %3
br label %21
10: ; preds = %0
store i32 30, i32* %3
br label %21
11: ; preds = %0
store i32 31, i32* %3
br label %21
12: ; preds = %0
store i32 30, i32* %3
br label %21
13: ; preds = %0
store i32 31, i32* %3
br label %21
14: ; preds = %0
store i32 31, i32* %3
br label %21
15: ; preds = %0
store i32 30, i32* %3
br label %21
16: ; preds = %0
store i32 31, i32* %3
br label %21
17: ; preds = %0
store i32 30, i32* %3
br label %21
18: ; preds = %0
store i32 31, i32* %3
br label %21
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7
%22 = load i32, i32* %2
%23 = icmp sge i32 %22, 1
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = load i32, i32* %2
%26 = icmp sle i32 %25, 12
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %28, i32 %29)
br label %31
31: ; preds = %27, %24, %21
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Input a month: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"wrong month\00"
@.str.3 = [21 x i8] c"month %d has %d days\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %10 [
i32 1, label %13
i32 2, label %17
i32 3, label %13
i32 4, label %6
i32 5, label %13
i32 6, label %7
i32 7, label %13
i32 8, label %13
i32 9, label %8
i32 10, label %13
i32 11, label %9
i32 12, label %13
]
6: ; preds = %0
br label %17
7: ; preds = %0
br label %17
8: ; preds = %0
br label %17
9: ; preds = %0
br label %17
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* %1
br label %13
13: ; preds = %0, %0, %0, %0, %0, %0, %0, %10
%14 = phi i32 [ %12, %10 ], [ %5, %0 ], [ %5, %0 ], [ %5, %0 ], [ %5, %0 ], [ %5, %0 ], [ %5, %0 ], [ %5, %0 ]
%15 = add i32 %14, -1
%16 = icmp ult i32 %15, 12
br i1 %16, label %17, label %21
17: ; preds = %0, %6, %7, %8, %9, %13
%18 = phi i32 [ 31, %13 ], [ 30, %6 ], [ 30, %7 ], [ 30, %8 ], [ 30, %9 ], [ 28, %0 ]
%19 = phi i32 [ %14, %13 ], [ %5, %6 ], [ %5, %7 ], [ %5, %8 ], [ %5, %9 ], [ %5, %0 ]
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %19, i32 %18)
br label %21
21: ; preds = %17, %13
ret i32 0
}