#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*/ pattern1();
int /*<<< orphan*/ pattern10();
int /*<<< orphan*/ pattern2();
int /*<<< orphan*/ pattern3();
int /*<<< orphan*/ pattern4();
int /*<<< orphan*/ pattern5();
int /*<<< orphan*/ pattern6();
int /*<<< orphan*/ pattern7();
int /*<<< orphan*/ pattern8();
int /*<<< orphan*/ pattern9();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  puts("Welcome to Pattern Maker!!");
  printf("Enter a no from (1-10) and view a unique pattern\nEnter Choice: ");
  int choice;
  scanf("%d", &choice);
  switch (choice) {
  case 1:
    pattern1();
    break;
  case 2:
    pattern2();
    break;
  case 3:
    pattern3();
    break;
  case 4:
    pattern4();
    break;
  case 5:
    pattern5();
    break;
  case 6:
    pattern6();
    break;
  case 7:
    pattern7();
    break;
  case 8:
    pattern8();
    break;
  case 9:
    pattern9();
    break;
  case 10:
    pattern10();
    break;
  default:
    puts("Invalid Input");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
lea    0xe85(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     12a8 <main+0xd8>
mov    -0x10(%rbp),%rax
lea    0xdd9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10d0 <pattern1@plt>
jmp    12b4 <main+0xe4>
mov    $0x0,%al
call   1060 <pattern2@plt>
jmp    12b4 <main+0xe4>
mov    $0x0,%al
call   10f0 <pattern3@plt>
jmp    12b4 <main+0xe4>
mov    $0x0,%al
call   1080 <pattern4@plt>
jmp    12b4 <main+0xe4>
mov    $0x0,%al
call   10e0 <pattern5@plt>
jmp    12b4 <main+0xe4>
mov    $0x0,%al
call   1070 <pattern6@plt>
jmp    12b4 <main+0xe4>
mov    $0x0,%al
call   10c0 <pattern7@plt>
jmp    12b4 <main+0xe4>
mov    $0x0,%al
call   1040 <pattern8@plt>
jmp    12b4 <main+0xe4>
mov    $0x0,%al
call   10b0 <pattern9@plt>
jmp    12b4 <main+0xe4>
mov    $0x0,%al
call   1090 <pattern10@plt>
jmp    12b4 <main+0xe4>
lea    0xdd7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe50(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe93(%rip),%rdi
lea    0x4(%rsp),%rsi
call   10a0 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x9,%eax
ja     121f <main+0x4f>
lea    0xdf3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   10d0 <pattern1@plt>
jmp    127c <main+0xac>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
jmp    127c <main+0xac>
xor    %eax,%eax
call   1060 <pattern2@plt>
jmp    127c <main+0xac>
xor    %eax,%eax
call   10f0 <pattern3@plt>
jmp    127c <main+0xac>
xor    %eax,%eax
call   1080 <pattern4@plt>
jmp    127c <main+0xac>
xor    %eax,%eax
call   10e0 <pattern5@plt>
jmp    127c <main+0xac>
xor    %eax,%eax
call   1070 <pattern6@plt>
jmp    127c <main+0xac>
xor    %eax,%eax
call   10c0 <pattern7@plt>
jmp    127c <main+0xac>
xor    %eax,%eax
call   1040 <pattern8@plt>
jmp    127c <main+0xac>
xor    %eax,%eax
call   1090 <pattern10@plt>
jmp    127c <main+0xac>
xor    %eax,%eax
call   10b0 <pattern9@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Welcome to Pattern Maker!!\00"
@.str.1 = [64 x i8] c"Enter a no from (1-10) and view a unique pattern\0AEnter Choice: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [14 x i8] c"Invalid Input\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
switch i32 %6, label %27 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %13
i32 5, label %15
i32 6, label %17
i32 7, label %19
i32 8, label %21
i32 9, label %23
i32 10, label %25
]
7: ; preds = %0
%8 = call i32 (...) @pattern1()
br label %29
9: ; preds = %0
%10 = call i32 (...) @pattern2()
br label %29
11: ; preds = %0
%12 = call i32 (...) @pattern3()
br label %29
13: ; preds = %0
%14 = call i32 (...) @pattern4()
br label %29
15: ; preds = %0
%16 = call i32 (...) @pattern5()
br label %29
17: ; preds = %0
%18 = call i32 (...) @pattern6()
br label %29
19: ; preds = %0
%20 = call i32 (...) @pattern7()
br label %29
21: ; preds = %0
%22 = call i32 (...) @pattern8()
br label %29
23: ; preds = %0
%24 = call i32 (...) @pattern9()
br label %29
25: ; preds = %0
%26 = call i32 (...) @pattern10()
br label %29
27: ; preds = %0
%28 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Welcome to Pattern Maker!!\00"
@.str.1 = [64 x i8] c"Enter a no from (1-10) and view a unique pattern\0AEnter Choice: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [14 x i8] c"Invalid Input\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
switch i32 %6, label %27 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %13
i32 5, label %15
i32 6, label %17
i32 7, label %19
i32 8, label %21
i32 9, label %23
i32 10, label %25
]
7: ; preds = %0
%8 = call i32 (...) @pattern1()
br label %29
9: ; preds = %0
%10 = call i32 (...) @pattern2()
br label %29
11: ; preds = %0
%12 = call i32 (...) @pattern3()
br label %29
13: ; preds = %0
%14 = call i32 (...) @pattern4()
br label %29
15: ; preds = %0
%16 = call i32 (...) @pattern5()
br label %29
17: ; preds = %0
%18 = call i32 (...) @pattern6()
br label %29
19: ; preds = %0
%20 = call i32 (...) @pattern7()
br label %29
21: ; preds = %0
%22 = call i32 (...) @pattern8()
br label %29
23: ; preds = %0
%24 = call i32 (...) @pattern9()
br label %29
25: ; preds = %0
%26 = call i32 (...) @pattern10()
br label %29
27: ; preds = %0
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7
ret i32 0
}