#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*/ clearScreen();
int /*<<< orphan*/ displayDayOnParticularDate(int, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void getMonthName(int ch) {
  int mon, year;
  clearScreen();
  printf("\n Enter the year : ");
  scanf("%d", &year);
  if (year < 100)
    year = year + 1900;
  printf("\n Enter the number of the month : ");
  scanf("%d", &mon);
  if (mon < 1 || mon > 12) {
    printf("\n Invalid month");
    return;
  }
  if (ch == 0) {
    displayDayOnParticularDate(mon, year, 0);
  } else {
    displayDayOnParticularDate(mon, year, 1);
  }
}


x86 assembly (clang, -O0):
<getMonthName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <clearScreen@plt>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x64,-0xc(%rbp)
jge    1183 <getMonthName+0x43>
mov    -0xc(%rbp),%eax
add    $0x76c,%eax
mov    %eax,-0xc(%rbp)
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     11b3 <getMonthName+0x73>
cmpl   $0xc,-0x8(%rbp)
jle    11c4 <getMonthName+0x84>
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
jmp    11f0 <getMonthName+0xb0>
cmpl   $0x0,-0x4(%rbp)
jne    11e0 <getMonthName+0xa0>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1030 <displayDayOnParticularDate@plt>
jmp    11f0 <getMonthName+0xb0>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x1,%edx
call   1030 <displayDayOnParticularDate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMonthName>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <clearScreen@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x63,%eax
jg     117d <getMonthName+0x3d>
add    $0x76c,%eax
mov    %eax,0x8(%rsp)
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
lea    0xe84(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
lea    -0xd(%rdi),%eax
cmp    $0xfffffff3,%eax
ja     11b4 <getMonthName+0x74>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
jmp    11ca <getMonthName+0x8a>
mov    0x8(%rsp),%esi
test   %ebx,%ebx
je     11c3 <getMonthName+0x83>
mov    $0x1,%edx
jmp    11c5 <getMonthName+0x85>
xor    %edx,%edx
call   1030 <displayDayOnParticularDate@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\0A Enter the year : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"\0A Enter the number of the month : \00"
@.str.3 = [16 x i8] c"\0A Invalid month\00"
define void @getMonthName(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 (...) @clearScreen()
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1900
store i32 %12, i32* %4
br label %13
13: ; preds = %10, %1
%14 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 1
br i1 %17, label %21, label %18
18: ; preds = %13
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 12
br i1 %20, label %21, label %23
21: ; preds = %18, %13
%22 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %34
23: ; preds = %18
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = call i32 @displayDayOnParticularDate(i32 %27, i32 %28, i32 0)
br label %34
30: ; preds = %23
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = call i32 @displayDayOnParticularDate(i32 %31, i32 %32, i32 1)
br label %34
34: ; preds = %21, %30, %26
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"\0A Enter the year : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"\0A Enter the number of the month : \00"
@.str.3 = [16 x i8] c"\0A Invalid month\00"
define void @getMonthName(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 (...) @clearScreen()
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 100
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = add nsw i32 %9, 1900
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %1
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%16 = load i32, i32* %2
%17 = add i32 %16, -13
%18 = icmp ult i32 %17, -12
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %28
21: ; preds = %13
%22 = icmp eq i32 %0, 0
%23 = load i32, i32* %3
br i1 %22, label %24, label %26
24: ; preds = %21
%25 = call i32 @displayDayOnParticularDate(i32 %16, i32 %23, i32 0)
br label %28
26: ; preds = %21
%27 = call i32 @displayDayOnParticularDate(i32 %16, i32 %23, i32 1)
br label %28
28: ; preds = %24, %26, %19
ret void
}