#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printMonth(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int iNumOfDays, iStartDay;
  printf("\nEnter the day of the week on which the month starts\n");
  scanf("%d", &iStartDay);
  printf("\nEnter the number of days in the month\n");
  scanf("%d", &iNumOfDays);
  if (iStartDay < 0 || iStartDay > 6 || iNumOfDays > 31 || iNumOfDays < 28) {
    printf("\nInvalid Input\n");
    exit(0);
  }
  printMonth(iStartDay, iNumOfDays);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jl     11af <main+0x6f>
cmpl   $0x6,-0xc(%rbp)
jg     11af <main+0x6f>
cmpl   $0x1f,-0x8(%rbp)
jg     11af <main+0x6f>
cmpl   $0x1c,-0x8(%rbp)
jge    11c2 <main+0x82>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <printMonth@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%edi
cmp    $0x6,%edi
ja     11a2 <main+0x62>
mov    0xc(%rsp),%esi
cmp    $0x1f,%esi
jg     11a2 <main+0x62>
cmp    $0x1b,%esi
jle    11a2 <main+0x62>
call   1050 <printMonth@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"\0AEnter the day of the week on which the month starts\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [40 x i8] c"\0AEnter the number of days in the month\0A\00"
@.str.3 = [16 x i8] c"\0AInvalid Input\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 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* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %0
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 6
br i1 %12, label %19, label %13
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 31
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 28
br i1 %18, label %19, label %22
19: ; preds = %16, %13, %10, %0
%20 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @exit(i32 0)
unreachable
22: ; preds = %16
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = call i32 @printMonth(i32 %23, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [53 x i8] c"\0AEnter the day of the week on which the month starts\00"
@str.4 = [39 x i8] c"\0AEnter the number of days in the month\00"
@str.5 = [15 x i8] c"\0AInvalid Input\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.4, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %2
%10 = icmp ugt i32 %9, 6
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 31
%13 = select i1 %10, i1 true, i1 %12
%14 = icmp slt i32 %11, 28
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %0
%20 = call i32 @printMonth(i32 %9, i32 %11)
ret i32 0
}