#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 n, a, b, c;
  scanf("%d", &n);
  printf("Sun Mon Tue Wen Thu Fri Sat\n");
  if (n == 1) {
    printf("      1   2   3   4   5   6\n  7   8   9  10  11  12  13\n 14  15  "
           "16  17  18  19  20\n 21  22  23  24  25  26  27\n 28  29  30");
  } else if (n == 2) {
    printf("          1   2   3   4   5\n  6   7   8   9  10  11  12\n 13  14  "
           "15  16  17  18  19\n 20  21  22  23  24  25  26\n 27  28  29  30");
  } else if (n == 3) {
    printf(
        "              1   2   3   4\n  5   6   7   8   9  10  11\n 12  13  14 "
        " 15  16  17  18\n 19  20  21  22  23  24  25\n 26  27  28  29  30");
  } else if (n == 4) {
    printf("                  1   2   3\n  4   5   6   7   8   9  10\n 11  12  "
           "13  14  15  16  17\n 18  19  20  21  22  23  24\n 25  26  27  28  "
           "29  30");
  } else if (n == 5) {
    printf("                      1   2\n  3   4   5   6   7   8   9\n 10  11  "
           "12  13  14  15  16\n 17  18  19  20  21  22  23\n 24  25  26  27  "
           "28  29  30");
  } else if (n == 6) {
    printf("                          1\n  2   3   4   5   6   7   8\n  9  10  "
           "11  12  13  14  15\n 16  17  18  19  20  21  22\n 23  24  25  26  "
           "27  28  29\n 30");
  } else {
    printf("  1   2   3   4   5   6   7\n  8   9  10  11  12  13  14\n 15  16  "
           "17  18  19  20  21\n 22  23  24  25  26  27  28\n 29  30");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1166 <main+0x46>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
jmp    1212 <main+0xf2>
cmpl   $0x2,-0x8(%rbp)
jne    1181 <main+0x61>
lea    0xf25(%rip),%rdi
call   1030 <printf@plt>
jmp    120d <main+0xed>
cmpl   $0x3,-0x8(%rbp)
jne    119c <main+0x7c>
lea    0xf8a(%rip),%rdi
call   1030 <printf@plt>
jmp    1208 <main+0xe8>
cmpl   $0x4,-0x8(%rbp)
jne    11b7 <main+0x97>
lea    0xff3(%rip),%rdi
call   1030 <printf@plt>
jmp    1203 <main+0xe3>
cmpl   $0x5,-0x8(%rbp)
jne    11d2 <main+0xb2>
lea    0x1060(%rip),%rdi
call   1030 <printf@plt>
jmp    11fe <main+0xde>
cmpl   $0x6,-0x8(%rbp)
jne    11ed <main+0xcd>
lea    0x10d1(%rip),%rdi
call   1030 <printf@plt>
jmp    11f9 <main+0xd9>
lea    0x1150(%rip),%rdi
call   1030 <printf@plt>
jmp    11fe <main+0xde>
jmp    1203 <main+0xe3>
jmp    1208 <main+0xe8>
jmp    120d <main+0xed>
jmp    1212 <main+0xf2>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
lea    0x1256(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x5,%eax
ja     116c <main+0x3c>
cltq
lea    0x1259(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1173 <main+0x43>
lea    0x11b4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"Sun Mon Tue Wen Thu Fri Sat\0A\00"
@.str.2 = [124 x i8] c" 1 2 3 4 5 6\0A 7 8 9 10 11 12 13\0A 14 15 16 17 18 19 20\0A 21 22 23 24 25 26 27\0A 28 29 30\00"
@.str.3 = [128 x i8] c" 1 2 3 4 5\0A 6 7 8 9 10 11 12\0A 13 14 15 16 17 18 19\0A 20 21 22 23 24 25 26\0A 27 28 29 30\00"
@.str.4 = [132 x i8] c" 1 2 3 4\0A 5 6 7 8 9 10 11\0A 12 13 14 15 16 17 18\0A 19 20 21 22 23 24 25\0A 26 27 28 29 30\00"
@.str.5 = [136 x i8] c" 1 2 3\0A 4 5 6 7 8 9 10\0A 11 12 13 14 15 16 17\0A 18 19 20 21 22 23 24\0A 25 26 27 28 29 30\00"
@.str.6 = [140 x i8] c" 1 2\0A 3 4 5 6 7 8 9\0A 10 11 12 13 14 15 16\0A 17 18 19 20 21 22 23\0A 24 25 26 27 28 29 30\00"
@.str.7 = [144 x i8] c" 1\0A 2 3 4 5 6 7 8\0A 9 10 11 12 13 14 15\0A 16 17 18 19 20 21 22\0A 23 24 25 26 27 28 29\0A 30\00"
@.str.8 = [120 x i8] c" 1 2 3 4 5 6 7\0A 8 9 10 11 12 13 14\0A 15 16 17 18 19 20 21\0A 22 23 24 25 26 27 28\0A 29 30\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.2, i64 0, i64 0))
br label %44
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str.3, i64 0, i64 0))
br label %43
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printf(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str.4, i64 0, i64 0))
br label %42
22: ; preds = %17
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 4
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @printf(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.5, i64 0, i64 0))
br label %41
27: ; preds = %22
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, 5
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @printf(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.6, i64 0, i64 0))
br label %40
32: ; preds = %27
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 6
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @printf(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.7, i64 0, i64 0))
br label %39
37: ; preds = %32
%38 = call i32 @printf(i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str.8, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
br label %40
40: ; preds = %39, %30
br label %41
41: ; preds = %40, %25
br label %42
42: ; preds = %41, %20
br label %43
43: ; preds = %42, %15
br label %44
44: ; preds = %43, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [124 x i8] c" 1 2 3 4 5 6\0A 7 8 9 10 11 12 13\0A 14 15 16 17 18 19 20\0A 21 22 23 24 25 26 27\0A 28 29 30\00"
@.str.3 = [128 x i8] c" 1 2 3 4 5\0A 6 7 8 9 10 11 12\0A 13 14 15 16 17 18 19\0A 20 21 22 23 24 25 26\0A 27 28 29 30\00"
@.str.4 = [132 x i8] c" 1 2 3 4\0A 5 6 7 8 9 10 11\0A 12 13 14 15 16 17 18\0A 19 20 21 22 23 24 25\0A 26 27 28 29 30\00"
@.str.5 = [136 x i8] c" 1 2 3\0A 4 5 6 7 8 9 10\0A 11 12 13 14 15 16 17\0A 18 19 20 21 22 23 24\0A 25 26 27 28 29 30\00"
@.str.6 = [140 x i8] c" 1 2\0A 3 4 5 6 7 8 9\0A 10 11 12 13 14 15 16\0A 17 18 19 20 21 22 23\0A 24 25 26 27 28 29 30\00"
@.str.7 = [144 x i8] c" 1\0A 2 3 4 5 6 7 8\0A 9 10 11 12 13 14 15\0A 16 17 18 19 20 21 22\0A 23 24 25 26 27 28 29\0A 30\00"
@.str.8 = [120 x i8] c" 1 2 3 4 5 6 7\0A 8 9 10 11 12 13 14\0A 15 16 17 18 19 20 21\0A 22 23 24 25 26 27 28\0A 29 30\00"
@str = [28 x i8] c"Sun Mon Tue Wen Thu Fri Sat\00"
@reltable.main = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([124 x i8]* @.str.2 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([128 x i8]* @.str.3 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([132 x i8]* @.str.4 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([136 x i8]* @.str.5 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([140 x i8]* @.str.6 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([144 x i8]* @.str.7 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%5 = load i32, i32* %1
%6 = add i32 %5, -1
%7 = icmp ult i32 %6, 6
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = sext i32 %6 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.main to i8*), i64 %10)
br label %12
12: ; preds = %0, %8
%13 = phi i8* [ %11, %8 ], [ getelementptr inbounds ([120 x i8], [120 x i8]* @.str.8, i64 0, i64 0), %0 ]
%14 = call i32 @printf(i8* dereferenceable(1) %13)
ret i32 0
}