#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, c, k, space = 1;
  printf("Enter number of rows\n");
  scanf("%d", &n);
  space = n - 1;
  for (k = 1; k <= n; k++) {
    for (c = 1; c <= space; c++)
      printf(" ");
    space--;
    for (c = 1; c <= 2 * k - 1; c++)
      printf("*");
    printf("\n");
  }
  space = 1;
  for (k = 1; k <= n - 1; k++) {
    for (c = 1; c <= space; c++)
      printf(" ");
    space++;
    for (c = 1; c <= 2 * (n - k) - 1; c++)
      printf("*");
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11f3 <main+0xd3>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     119b <main+0x7b>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1175 <main+0x55>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11d9 <main+0xb9>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ab <main+0x8b>
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1162 <main+0x42>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     129a <main+0x17a>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     123f <main+0x11f>
lea    0xded(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1219 <main+0xf9>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x10(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1280 <main+0x160>
lea    0xdae(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    124f <main+0x12f>
lea    0xd8d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1201 <main+0xe1>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%r14d
test   %r14d,%r14d
jle    124b <main+0x11b>
mov    $0x1,%r12d
mov    %r14d,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14d,%ebp
cmp    $0x2,%r15d
jl     11a1 <main+0x71>
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    1190 <main+0x60>
add    $0xffffffff,%r15d
mov    %r12d,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%ecx
mov    0xc(%rsp),%eax
add    $0x2,%r12d
cmp    %eax,%ebx
mov    %ecx,%ebx
jl     1180 <main+0x50>
cmp    $0x2,%eax
jl     124b <main+0x11b>
mov    $0x1,%r14d
jmp    1201 <main+0xd1>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    0xc(%rsp),%r14d
jge    124b <main+0x11b>
mov    %r14d,%ebp
mov    %r14d,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1210 <main+0xe0>
lea    0x1(%rbp),%r14d
cmp    %ebp,0xc(%rsp)
jle    11f0 <main+0xc0>
mov    $0x1,%ebx
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
sub    %ebp,%eax
add    %eax,%eax
cmp    %eax,%ebx
jl     1230 <main+0x100>
jmp    11f0 <main+0xc0>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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