#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 /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
char *asctime(struct tm *);
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_cal(int, int);
int /*<<< orphan*/ sscanf(char *, char *, int /*<<< orphan*/ *, char *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  int mo, year;
  char m[4], y[5];
  time_t now;
  struct tm *ptr;
  char mbuff[4], ybuff[5];
  char *t;
  if (argc == 1) {
    time(&now);
    ptr = localtime(&now);
    t = asctime(ptr);
    sscanf(t, "%s%s%s%s%s", NULL, mbuff, NULL, NULL, ybuff);
    if (strcmp(mbuff, "Jan") == 0)
      mo = 1;
    if (strcmp(mbuff, "Feb") == 0)
      mo = 2;
    if (strcmp(mbuff, "Mar") == 0)
      mo = 3;
    if (strcmp(mbuff, "Apr") == 0)
      mo = 4;
    if (strcmp(mbuff, "May") == 0)
      mo = 5;
    if (strcmp(mbuff, "Jun") == 0)
      mo = 6;
    if (strcmp(mbuff, "Jul") == 0)
      mo = 7;
    if (strcmp(mbuff, "Aug") == 0)
      mo = 8;
    if (strcmp(mbuff, "Sep") == 0)
      mo = 9;
    if (strcmp(mbuff, "Oct") == 0)
      mo = 10;
    if (strcmp(mbuff, "Nov") == 0)
      mo = 11;
    if (strcmp(mbuff, "Dec") == 0)
      mo = 12;
    if ((mo <= 0) || (mo > 12)) {
      usage();
      exit(0);
    }
    year = atoi(ybuff);
    if ((year < 1901) || (year > 32767)) {
      usage();
      exit(0);
    }
    print_cal(mo, year);
    exit(0);
  } else if (argc > 1) {
    int param = 1;
    if (argv[param][0] == '-') {
      switch (argv[param][1]) {
      case 'i':
        fputs("Enter month [1-12]:\n", stdout);
        fgets(m, 3, stdin);
        mo = atoi(m);
        if ((mo <= 0) || (mo > 12)) {
          usage();
          exit(0);
        }
        fputs("Enter year [2000]:\n", stdout);
        fgets(y, 5, stdin);
        year = atoi(y);
        if ((year < 1901) || (year > 32767)) {
          usage();
          exit(0);
        }
        print_cal(mo, year);
        exit(0);
        break;
      case 'h':
      case '?':
      default:
        usage();
        exit(0);
        break;
      }
    }
    mo = atoi(argv[1]);
    if ((mo <= 0) || (mo > 12)) {
      usage();
      exit(0);
    }
    year = atoi(argv[2]);
    if ((year < 1901) || (year > 32767)) {
      usage();
      exit(0);
    }
  }
  print_cal(mo, year);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    140e <main+0x25e>
lea    -0x28(%rbp),%rdi
call   1090 <time@plt>
lea    -0x28(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <asctime@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x34(%rbp),%rcx
lea    -0x39(%rbp),%rax
lea    0xdfa(%rip),%rsi
xor    %edx,%edx
mov    %edx,%r9d
mov    %r9,%rdx
mov    %r9,%r8
mov    %rax,(%rsp)
call   10a0 <sscanf@plt>
lea    -0x34(%rbp),%rdi
lea    0xde6(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    123b <main+0x8b>
movl   $0x1,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xdc9(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    125c <main+0xac>
movl   $0x2,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xdac(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    127d <main+0xcd>
movl   $0x3,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xd8f(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    129e <main+0xee>
movl   $0x4,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xd72(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12bf <main+0x10f>
movl   $0x5,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xd55(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12e0 <main+0x130>
movl   $0x6,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xd38(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1301 <main+0x151>
movl   $0x7,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xd1b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1322 <main+0x172>
movl   $0x8,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xcfe(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1343 <main+0x193>
movl   $0x9,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xce1(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1364 <main+0x1b4>
movl   $0xa,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xcc4(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1385 <main+0x1d5>
movl   $0xb,-0x14(%rbp)
lea    -0x34(%rbp),%rdi
lea    0xca7(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    13a6 <main+0x1f6>
movl   $0xc,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    13ba <main+0x20a>
cmpl   $0xc,-0x14(%rbp)
jle    13c8 <main+0x218>
mov    $0x0,%al
call   10b0 <usage@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
lea    -0x39(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x76d,-0x18(%rbp)
jl     13ee <main+0x23e>
cmpl   $0x7fff,-0x18(%rbp)
jle    13fc <main+0x24c>
mov    $0x0,%al
call   10b0 <usage@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <print_cal@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
cmpl   $0x1,-0x8(%rbp)
jle    15c8 <main+0x418>
movl   $0x1,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1559 <main+0x3a9>
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x50(%rbp)
sub    $0x3f,%eax
je     1546 <main+0x396>
jmp    1458 <main+0x2a8>
mov    -0x50(%rbp),%eax
sub    $0x68,%eax
je     1546 <main+0x396>
jmp    1469 <main+0x2b9>
mov    -0x50(%rbp),%eax
sub    $0x69,%eax
jne    154b <main+0x39b>
jmp    147a <main+0x2ca>
mov    0x2b57(%rip),%rax
mov    (%rax),%esi
lea    0xbb1(%rip),%rdi
call   1060 <fputs@plt>
lea    -0x1c(%rbp),%rdi
mov    0x2b4e(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%esi
call   1070 <fgets@plt>
lea    -0x1c(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    14c6 <main+0x316>
cmpl   $0xc,-0x14(%rbp)
jle    14d4 <main+0x324>
mov    $0x0,%al
call   10b0 <usage@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    0x2afd(%rip),%rax
mov    (%rax),%esi
lea    0xb6c(%rip),%rdi
call   1060 <fputs@plt>
lea    -0x21(%rbp),%rdi
mov    0x2af4(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1070 <fgets@plt>
lea    -0x21(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x76d,-0x18(%rbp)
jl     1526 <main+0x376>
cmpl   $0x7fff,-0x18(%rbp)
jle    1534 <main+0x384>
mov    $0x0,%al
call   10b0 <usage@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <print_cal@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
jmp    154b <main+0x39b>
mov    $0x0,%al
call   10b0 <usage@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    157d <main+0x3cd>
cmpl   $0xc,-0x14(%rbp)
jle    158b <main+0x3db>
mov    $0x0,%al
call   10b0 <usage@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x76d,-0x18(%rbp)
jl     15b5 <main+0x405>
cmpl   $0x7fff,-0x18(%rbp)
jle    15c3 <main+0x413>
mov    $0x0,%al
call   10b0 <usage@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
jmp    15c8 <main+0x418>
jmp    15cd <main+0x41d>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <print_cal@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x1,%edi
jne    139d <main+0x1ed>
lea    0x14(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <time@plt>
mov    %rbx,%rdi
call   1040 <localtime@plt>
mov    %rax,%rdi
call   1050 <asctime@plt>
lea    0xf(%rsp),%rcx
mov    %rcx,(%rsp)
lea    0xe0c(%rip),%rsi
lea    0x44(%rsp),%rbx
mov    %rax,%rdi
xor    %edx,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   10a0 <sscanf@plt>
lea    0xdf8(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
lea    0xded(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,0x38(%rsp)
lea    0xddd(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,0x30(%rsp)
lea    0xdcd(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,0x28(%rsp)
lea    0xdbd(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,0x20(%rsp)
lea    0xdad(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,0x18(%rsp)
lea    0xd9d(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,%r15
lea    0xd8f(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,%r12
lea    0xd81(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,%r13
lea    0xd73(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,%rbp
lea    0xd65(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,%r14
lea    0xd57(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
mov    %rax,%rbx
lea    0xf(%rsp),%rdi
call   10c0 <atoi@plt>
lea    -0x8000(%rax),%ecx
cmp    $0xffff876c,%ecx
jbe    1462 <main+0x2b2>
cmpq   $0x1,0x38(%rsp)
mov    $0x1,%ecx
adc    $0x0,%ecx
cmpq   $0x0,0x30(%rsp)
mov    $0x3,%edx
cmovne %ecx,%edx
cmpq   $0x0,0x28(%rsp)
mov    $0x4,%ecx
cmovne %edx,%ecx
cmpq   $0x0,0x20(%rsp)
mov    $0x5,%edx
cmovne %ecx,%edx
cmpq   $0x0,0x18(%rsp)
mov    $0x6,%ecx
cmovne %edx,%ecx
test   %r15,%r15
mov    $0x7,%edx
cmovne %ecx,%edx
test   %r12,%r12
mov    $0x8,%ecx
cmovne %edx,%ecx
test   %r13,%r13
mov    $0x9,%edx
cmovne %ecx,%edx
test   %rbp,%rbp
mov    $0xa,%ecx
cmovne %edx,%ecx
test   %r14,%r14
mov    $0xb,%edx
cmovne %ecx,%edx
test   %rbx,%rbx
mov    $0xc,%edi
cmovne %edx,%edi
mov    %eax,%esi
call   1030 <print_cal@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
cmpb   $0x2d,(%rdi)
jne    143c <main+0x28c>
cmpb   $0x69,0x1(%rdi)
jne    1462 <main+0x2b2>
mov    0x2c1a(%rip),%r14
mov    (%r14),%esi
lea    0xc73(%rip),%rdi
call   1060 <fputs@plt>
mov    0x2c14(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0x14(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
call   10c0 <atoi@plt>
mov    %eax,%ebx
lea    -0xd(%rbx),%eax
cmp    $0xfffffff3,%eax
jbe    1462 <main+0x2b2>
mov    (%r14),%esi
lea    0xc4b(%rip),%rdi
call   1060 <fputs@plt>
mov    0x0(%rbp),%edx
lea    0xf(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x5,%esi
call   1070 <fgets@plt>
mov    %rbp,%rdi
call   10c0 <atoi@plt>
lea    -0x8000(%rax),%ecx
cmp    $0xffff876c,%ecx
jbe    1462 <main+0x2b2>
mov    %ebx,%edi
jmp    138f <main+0x1df>
call   10c0 <atoi@plt>
mov    %eax,%ebp
lea    -0xd(%rbp),%eax
cmp    $0xfffffff3,%eax
jbe    1462 <main+0x2b2>
mov    0x10(%rbx),%rdi
call   10c0 <atoi@plt>
lea    -0x8000(%rax),%ecx
cmp    $0xffff876c,%ecx
ja     1470 <main+0x2c0>
xor    %eax,%eax
call   10b0 <usage@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    %ebp,%edi
jmp    138f <main+0x1df>

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [11 x i8] c"%s%s%s%s%s\00"
@.str.1 = [4 x i8] c"Jan\00"
@.str.2 = [4 x i8] c"Feb\00"
@.str.3 = [4 x i8] c"Mar\00"
@.str.4 = [4 x i8] c"Apr\00"
@.str.5 = [4 x i8] c"May\00"
@.str.6 = [4 x i8] c"Jun\00"
@.str.7 = [4 x i8] c"Jul\00"
@.str.8 = [4 x i8] c"Aug\00"
@.str.9 = [4 x i8] c"Sep\00"
@.str.10 = [4 x i8] c"Oct\00"
@.str.11 = [4 x i8] c"Nov\00"
@.str.12 = [4 x i8] c"Dec\00"
@.str.13 = [21 x i8] c"Enter month [1-12]:\0A\00"
@stdout = global i32 0
@stdin = global i32 0
@.str.14 = [20 x i8] c"Enter year [2000]:\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [4 x i8]
%9 = alloca [5 x i8]
%10 = alloca i32
%11 = alloca %struct.tm*
%12 = alloca [4 x i8]
%13 = alloca [5 x i8]
%14 = alloca i8*
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %111
18: ; preds = %2
%19 = call i32 @time(i32* %10)
%20 = call %struct.tm* @localtime(i32* %10)
store %struct.tm* %20, %struct.tm** %11
%21 = load %struct.tm*, %struct.tm** %11
%22 = call i8* @asctime(%struct.tm* %21)
store i8* %22, i8** %14
%23 = load i8*, i8** %14
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%25 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%26 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* null, i8* %24, i32* null, i32* null, i8* %25)
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %18
store i32 1, i32* %6
br label %31
31: ; preds = %30, %18
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 2, i32* %6
br label %36
36: ; preds = %35, %31
%37 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %36
store i32 3, i32* %6
br label %41
41: ; preds = %40, %36
%42 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %41
store i32 4, i32* %6
br label %46
46: ; preds = %45, %41
%47 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %46
store i32 5, i32* %6
br label %51
51: ; preds = %50, %46
%52 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %51
store i32 6, i32* %6
br label %56
56: ; preds = %55, %51
%57 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %56
store i32 7, i32* %6
br label %61
61: ; preds = %60, %56
%62 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%63 = call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %61
store i32 8, i32* %6
br label %66
66: ; preds = %65, %61
%67 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%68 = call i64 @strcmp(i8* %67, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %71
70: ; preds = %66
store i32 9, i32* %6
br label %71
71: ; preds = %70, %66
%72 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %76
75: ; preds = %71
store i32 10, i32* %6
br label %76
76: ; preds = %75, %71
%77 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%78 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %81
80: ; preds = %76
store i32 11, i32* %6
br label %81
81: ; preds = %80, %76
%82 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%83 = call i64 @strcmp(i8* %82, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %86
85: ; preds = %81
store i32 12, i32* %6
br label %86
86: ; preds = %85, %81
%87 = load i32, i32* %6
%88 = icmp sle i32 %87, 0
br i1 %88, label %92, label %89
89: ; preds = %86
%90 = load i32, i32* %6
%91 = icmp sgt i32 %90, 12
br i1 %91, label %92, label %95
92: ; preds = %89, %86
%93 = call i32 (...) @usage()
%94 = call i32 @exit(i32 0)
unreachable
95: ; preds = %89
%96 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%97 = call i32 @atoi(i8* %96)
store i32 %97, i32* %7
%98 = load i32, i32* %7
%99 = icmp slt i32 %98, 1901
br i1 %99, label %103, label %100
100: ; preds = %95
%101 = load i32, i32* %7
%102 = icmp sgt i32 %101, 32767
br i1 %102, label %103, label %106
103: ; preds = %100, %95
%104 = call i32 (...) @usage()
%105 = call i32 @exit(i32 0)
unreachable
106: ; preds = %100
%107 = load i32, i32* %6
%108 = load i32, i32* %7
%109 = call i32 @print_cal(i32 %107, i32 %108)
%110 = call i32 @exit(i32 0)
unreachable
111: ; preds = %2
%112 = load i32, i32* %4
%113 = icmp sgt i32 %112, 1
br i1 %113, label %114, label %201
114: ; preds = %111
store i32 1, i32* %15
%115 = load i8**, i8*** %5
%116 = load i32, i32* %15
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8*, i8** %115, i64 %117
%119 = load i8*, i8** %118
%120 = getelementptr inbounds i8, i8* %119, i64 0
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = icmp eq i32 %122, 45
br i1 %123, label %124, label %174
124: ; preds = %114
%125 = load i8**, i8*** %5
%126 = load i32, i32* %15
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8*, i8** %125, i64 %127
%129 = load i8*, i8** %128
%130 = getelementptr inbounds i8, i8* %129, i64 1
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
switch i32 %132, label %171 [
i32 105, label %133
i32 104, label %170
i32 63, label %170
]
133: ; preds = %124
%134 = load i32, i32* @stdout
%135 = call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 %134)
%136 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%137 = load i32, i32* @stdin
%138 = call i32 @fgets(i8* %136, i32 3, i32 %137)
%139 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%140 = call i32 @atoi(i8* %139)
store i32 %140, i32* %6
%141 = load i32, i32* %6
%142 = icmp sle i32 %141, 0
br i1 %142, label %146, label %143
143: ; preds = %133
%144 = load i32, i32* %6
%145 = icmp sgt i32 %144, 12
br i1 %145, label %146, label %149
146: ; preds = %143, %133
%147 = call i32 (...) @usage()
%148 = call i32 @exit(i32 0)
unreachable
149: ; preds = %143
%150 = load i32, i32* @stdout
%151 = call i32 @fputs(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i32 %150)
%152 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%153 = load i32, i32* @stdin
%154 = call i32 @fgets(i8* %152, i32 5, i32 %153)
%155 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%156 = call i32 @atoi(i8* %155)
store i32 %156, i32* %7
%157 = load i32, i32* %7
%158 = icmp slt i32 %157, 1901
br i1 %158, label %162, label %159
159: ; preds = %149
%160 = load i32, i32* %7
%161 = icmp sgt i32 %160, 32767
br i1 %161, label %162, label %165
162: ; preds = %159, %149
%163 = call i32 (...) @usage()
%164 = call i32 @exit(i32 0)
unreachable
165: ; preds = %159
%166 = load i32, i32* %6
%167 = load i32, i32* %7
%168 = call i32 @print_cal(i32 %166, i32 %167)
%169 = call i32 @exit(i32 0)
unreachable
170: ; preds = %124, %124
br label %171
171: ; preds = %124, %170
%172 = call i32 (...) @usage()
%173 = call i32 @exit(i32 0)
unreachable
174: ; preds = %114
%175 = load i8**, i8*** %5
%176 = getelementptr inbounds i8*, i8** %175, i64 1
%177 = load i8*, i8** %176
%178 = call i32 @atoi(i8* %177)
store i32 %178, i32* %6
%179 = load i32, i32* %6
%180 = icmp sle i32 %179, 0
br i1 %180, label %184, label %181
181: ; preds = %174
%182 = load i32, i32* %6
%183 = icmp sgt i32 %182, 12
br i1 %183, label %184, label %187
184: ; preds = %181, %174
%185 = call i32 (...) @usage()
%186 = call i32 @exit(i32 0)
unreachable
187: ; preds = %181
%188 = load i8**, i8*** %5
%189 = getelementptr inbounds i8*, i8** %188, i64 2
%190 = load i8*, i8** %189
%191 = call i32 @atoi(i8* %190)
store i32 %191, i32* %7
%192 = load i32, i32* %7
%193 = icmp slt i32 %192, 1901
br i1 %193, label %197, label %194
194: ; preds = %187
%195 = load i32, i32* %7
%196 = icmp sgt i32 %195, 32767
br i1 %196, label %197, label %200
197: ; preds = %194, %187
%198 = call i32 (...) @usage()
%199 = call i32 @exit(i32 0)
unreachable
200: ; preds = %194
br label %201
201: ; preds = %200, %111
br label %202
202: ; preds = %201
%203 = load i32, i32* %6
%204 = load i32, i32* %7
%205 = call i32 @print_cal(i32 %203, i32 %204)
%206 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [11 x i8] c"%s%s%s%s%s\00"
@.str.1 = [4 x i8] c"Jan\00"
@.str.2 = [4 x i8] c"Feb\00"
@.str.3 = [4 x i8] c"Mar\00"
@.str.4 = [4 x i8] c"Apr\00"
@.str.5 = [4 x i8] c"May\00"
@.str.6 = [4 x i8] c"Jun\00"
@.str.7 = [4 x i8] c"Jul\00"
@.str.8 = [4 x i8] c"Aug\00"
@.str.9 = [4 x i8] c"Sep\00"
@.str.10 = [4 x i8] c"Oct\00"
@.str.11 = [4 x i8] c"Nov\00"
@.str.12 = [4 x i8] c"Dec\00"
@.str.13 = [21 x i8] c"Enter month [1-12]:\0A\00"
@stdout = global i32 0
@stdin = global i32 0
@.str.14 = [20 x i8] c"Enter year [2000]:\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4 x i8]
%4 = alloca [5 x i8]
%5 = alloca i32
%6 = alloca [4 x i8]
%7 = alloca [5 x i8]
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%10 = bitcast i32* %5 to i8*
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%13 = icmp eq i32 %0, 1
br i1 %13, label %14, label %62
14: ; preds = %2
%15 = call i32 @time(i32* %5)
%16 = call %struct.tm* @localtime(i32* %5)
%17 = call i8* @asctime(%struct.tm* %16)
%18 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* null, i8* %11, i32* null, i32* null, i8* %12)
%19 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%20 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%21 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%22 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%23 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%24 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%25 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%26 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%27 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%28 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%29 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%30 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%31 = call i32 @atoi(i8* %12)
%32 = add i32 %31, -32768
%33 = icmp ult i32 %32, -30867
br i1 %33, label %34, label %37
34: ; preds = %14
%35 = call i32 (...) @usage()
%36 = call i32 @exit(i32 0)
unreachable
37: ; preds = %14
%38 = icmp eq i64 %30, 0
%39 = icmp eq i64 %29, 0
%40 = icmp eq i64 %28, 0
%41 = icmp eq i64 %27, 0
%42 = icmp eq i64 %26, 0
%43 = icmp eq i64 %25, 0
%44 = icmp eq i64 %24, 0
%45 = icmp eq i64 %23, 0
%46 = icmp eq i64 %22, 0
%47 = icmp eq i64 %21, 0
%48 = icmp eq i64 %20, 0
%49 = select i1 %48, i32 2, i32 1
%50 = select i1 %47, i32 3, i32 %49
%51 = select i1 %46, i32 4, i32 %50
%52 = select i1 %45, i32 5, i32 %51
%53 = select i1 %44, i32 6, i32 %52
%54 = select i1 %43, i32 7, i32 %53
%55 = select i1 %42, i32 8, i32 %54
%56 = select i1 %41, i32 9, i32 %55
%57 = select i1 %40, i32 10, i32 %56
%58 = select i1 %39, i32 11, i32 %57
%59 = select i1 %38, i32 12, i32 %58
%60 = call i32 @print_cal(i32 %59, i32 %31)
%61 = call i32 @exit(i32 0)
unreachable
62: ; preds = %2
%63 = icmp sgt i32 %0, 1
tail call void @llvm.assume(i1 %63)
%64 = getelementptr inbounds i8*, i8** %1, i64 1
%65 = load i8*, i8** %64
%66 = load i8, i8* %65
%67 = icmp eq i8 %66, 45
br i1 %67, label %68, label %100
68: ; preds = %62
%69 = getelementptr inbounds i8, i8* %65, i64 1
%70 = load i8, i8* %69
%71 = icmp eq i8 %70, 105
br i1 %71, label %72, label %97
72: ; preds = %68
%73 = load i32, i32* @stdout
%74 = tail call i32 @fputs(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 %73)
%75 = load i32, i32* @stdin
%76 = call i32 @fgets(i8* %8, i32 3, i32 %75)
%77 = call i32 @atoi(i8* %8)
%78 = add i32 %77, -13
%79 = icmp ult i32 %78, -12
br i1 %79, label %80, label %83
80: ; preds = %72
%81 = call i32 (...) @usage()
%82 = call i32 @exit(i32 0)
unreachable
83: ; preds = %72
%84 = load i32, i32* @stdout
%85 = call i32 @fputs(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i32 %84)
%86 = load i32, i32* @stdin
%87 = call i32 @fgets(i8* %9, i32 5, i32 %86)
%88 = call i32 @atoi(i8* %9)
%89 = add i32 %88, -32768
%90 = icmp ult i32 %89, -30867
br i1 %90, label %91, label %94
91: ; preds = %83
%92 = call i32 (...) @usage()
%93 = call i32 @exit(i32 0)
unreachable
94: ; preds = %83
%95 = call i32 @print_cal(i32 %77, i32 %88)
%96 = call i32 @exit(i32 0)
unreachable
97: ; preds = %68
%98 = tail call i32 (...) @usage()
%99 = tail call i32 @exit(i32 0)
unreachable
100: ; preds = %62
%101 = tail call i32 @atoi(i8* %65)
%102 = add i32 %101, -13
%103 = icmp ult i32 %102, -12
br i1 %103, label %104, label %107
104: ; preds = %100
%105 = tail call i32 (...) @usage()
%106 = tail call i32 @exit(i32 0)
unreachable
107: ; preds = %100
%108 = getelementptr inbounds i8*, i8** %1, i64 2
%109 = load i8*, i8** %108
%110 = tail call i32 @atoi(i8* %109)
%111 = add i32 %110, -32768
%112 = icmp ult i32 %111, -30867
br i1 %112, label %113, label %116
113: ; preds = %107
%114 = tail call i32 (...) @usage()
%115 = tail call i32 @exit(i32 0)
unreachable
116: ; preds = %107
%117 = tail call i32 @print_cal(i32 %101, i32 %110)
%118 = tail call i32 @exit(i32 0)
unreachable
}