#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 i, j, k, num;
  printf("enter the size of pattern: ");
  scanf("%d", &num);
  for (i = 0; i < num; i++) {
    for (j = 0; j < num - i - 1; j++) {
      printf("  ");
    }
    for (k = 0; k <= i * 2; k++) {
      printf("* ");
    }
    printf("\n");
  }
  for (i = 0; i < num - 1; i++) {
    for (j = 0; j <= i; j++) {
      printf("  ");
    }
    for (k = 1; k < (num - i - 1) * 2; k++) {
      printf("* ");
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11df <main+0xbf>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1193 <main+0x73>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <main+0x45>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jg     11c5 <main+0xa5>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119a <main+0x7a>
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <main+0x32>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1276 <main+0x156>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1224 <main+0x104>
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fe <main+0xde>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x8(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    125c <main+0x13c>
lea    0xdd9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    122b <main+0x10b>
lea    0xdc2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e6 <main+0xc6>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1279 <main+0x149>
xor    %r12d,%r12d
mov    $0x1,%r15d
lea    0xeab(%rip),%r14
lea    0xea7(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %r12d,%ebp
not    %ebp
add    %ebp,%eax
test   %eax,%eax
jle    11a5 <main+0x75>
xor    %ebx,%ebx
nopl   (%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
add    %ebp,%eax
cmp    %eax,%ebx
jl     1190 <main+0x60>
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
mov    0x4(%rsp),%eax
add    $0x2,%r15d
cmp    %eax,%r12d
jl     1180 <main+0x50>
cmp    $0x2,%eax
jl     1279 <main+0x149>
xor    %r12d,%r12d
mov    $0x1,%r15d
lea    0xe2e(%rip),%r13
lea    0xe2a(%rip),%r14
jmp    121e <main+0xee>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
add    $0x1,%r15d
cmp    %eax,%r12d
jge    1279 <main+0x149>
mov    %r15d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    1230 <main+0x100>
mov    %r12d,%ebp
not    %ebp
mov    0x4(%rsp),%eax
add    %ebp,%eax
test   %eax,%eax
jle    1200 <main+0xd0>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
add    %ebp,%eax
add    %eax,%eax
cmp    %eax,%ebx
jl     1260 <main+0x130>
jmp    1200 <main+0xd0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"enter the size of pattern: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [3 x i8] c"* \00"
@.str.4 = [2 x i8] c"\0A\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 @printf(i8* getelementptr inbounds ([28 x i8], [28 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* %5)
store i32 0, i32* %2
br label %8
8: ; preds = %38, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %41
12: ; preds = %8
store i32 0, i32* %3
br label %13
13: ; preds = %22, %12
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = load i32, i32* %2
%17 = sub nsw i32 %15, %16
%18 = sub nsw i32 %17, 1
%19 = icmp slt i32 %14, %18
br i1 %19, label %20, label %25
20: ; preds = %13
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %13
25: ; preds = %13
store i32 0, i32* %4
br label %26
26: ; preds = %33, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %2
%29 = mul nsw i32 %28, 2
%30 = icmp sle i32 %27, %29
br i1 %30, label %31, label %36
31: ; preds = %26
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %26
36: ; preds = %26
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %8
41: ; preds = %8
store i32 0, i32* %2
br label %42
42: ; preds = %73, %41
%43 = load i32, i32* %2
%44 = load i32, i32* %5
%45 = sub nsw i32 %44, 1
%46 = icmp slt i32 %43, %45
br i1 %46, label %47, label %76
47: ; preds = %42
store i32 0, i32* %3
br label %48
48: ; preds = %54, %47
%49 = load i32, i32* %3
%50 = load i32, i32* %2
%51 = icmp sle i32 %49, %50
br i1 %51, label %52, label %57
52: ; preds = %48
%53 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %54
54: ; preds = %52
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %48
57: ; preds = %48
store i32 1, i32* %4
br label %58
58: ; preds = %68, %57
%59 = load i32, i32* %4
%60 = load i32, i32* %5
%61 = load i32, i32* %2
%62 = sub nsw i32 %60, %61
%63 = sub nsw i32 %62, 1
%64 = mul nsw i32 %63, 2
%65 = icmp slt i32 %59, %64
br i1 %65, label %66, label %71
66: ; preds = %58
%67 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %68
68: ; preds = %66
%69 = load i32, i32* %4
%70 = add nsw i32 %69, 1
store i32 %70, i32* %4
br label %58
71: ; preds = %58
%72 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %73
73: ; preds = %71
%74 = load i32, i32* %2
%75 = add nsw i32 %74, 1
store i32 %75, i32* %2
br label %42
76: ; preds = %42
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"enter the size of pattern: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [3 x i8] c"* \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %63
7: ; preds = %0, %29
%8 = phi i32 [ %32, %29 ], [ %5, %0 ]
%9 = phi i32 [ %34, %29 ], [ 1, %0 ]
%10 = phi i32 [ %31, %29 ], [ 0, %0 ]
%11 = xor i32 %10, -1
%12 = add i32 %8, %11
%13 = icmp sgt i32 %12, 0
br i1 %13, label %16, label %23
14: ; preds = %29
%15 = icmp sgt i32 %32, 1
br i1 %15, label %35, label %63
16: ; preds = %7, %16
%17 = phi i32 [ %19, %16 ], [ 0, %7 ]
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = add nuw nsw i32 %17, 1
%20 = load i32, i32* %1
%21 = add i32 %20, %11
%22 = icmp slt i32 %19, %21
br i1 %22, label %16, label %23
23: ; preds = %16, %7
br label %24
24: ; preds = %23, %24
%25 = phi i32 [ %27, %24 ], [ 0, %23 ]
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%27 = add nuw i32 %25, 1
%28 = icmp eq i32 %27, %9
br i1 %28, label %29, label %24
29: ; preds = %24
%30 = call i32 @putchar(i32 10)
%31 = add nuw nsw i32 %10, 1
%32 = load i32, i32* %1
%33 = icmp slt i32 %31, %32
%34 = add nuw i32 %9, 2
br i1 %33, label %7, label %14
35: ; preds = %14, %56
%36 = phi i32 [ %62, %56 ], [ 1, %14 ]
%37 = phi i32 [ %58, %56 ], [ 0, %14 ]
br label %43
38: ; preds = %43
%39 = xor i32 %37, -1
%40 = load i32, i32* %1
%41 = add i32 %40, %39
%42 = icmp sgt i32 %41, 0
br i1 %42, label %48, label %56
43: ; preds = %35, %43
%44 = phi i32 [ 0, %35 ], [ %46, %43 ]
%45 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%46 = add nuw nsw i32 %44, 1
%47 = icmp eq i32 %46, %36
br i1 %47, label %38, label %43
48: ; preds = %38, %48
%49 = phi i32 [ %51, %48 ], [ 1, %38 ]
%50 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%51 = add nuw nsw i32 %49, 1
%52 = load i32, i32* %1
%53 = add i32 %52, %39
%54 = shl nsw i32 %53, 1
%55 = icmp slt i32 %51, %54
br i1 %55, label %48, label %56
56: ; preds = %48, %38
%57 = call i32 @putchar(i32 10)
%58 = add nuw nsw i32 %37, 1
%59 = load i32, i32* %1
%60 = add nsw i32 %59, -1
%61 = icmp slt i32 %58, %60
%62 = add nuw i32 %36, 1
br i1 %61, label %35, label %63
63: ; preds = %56, %0, %14
ret i32 0
}