#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 *);
main() {
  int i, n, k, space;
  printf("Number of lines: ");
  scanf("%d", &n);
  space = n - 1;
  for (k = 1; k <= n; k++) {
    for (i = 1; i <= space; i++) {
      printf(" ");
    }
    space--;
    for (i = 1; i <= 2 * k - 1; i++) {
      printf("*");
    }
    printf("\n");
  }
  space = 1;
  for (k = 1; k <= n; k++) {
    for (i = 1; i <= space; i++) {
      printf(" ");
    }
    space++;
    for (i = 1; i <= 2 * (n - k) - 1; i++) {
      printf("*");
    }
    printf("\n");
  }
}


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    0xed0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11ec <main+0xcc>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1194 <main+0x74>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116e <main+0x4e>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11d2 <main+0xb2>
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a4 <main+0x84>
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115b <main+0x3b>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     128e <main+0x16e>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1233 <main+0x113>
lea    0xdf0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    120d <main+0xed>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x10(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1274 <main+0x154>
lea    0xdb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1243 <main+0x123>
lea    0xd9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11fa <main+0xda>
mov    -0x4(%rbp),%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    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xec3(%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>
test   %eax,%eax
jle    124b <main+0x11b>
mov    $0x1,%ebx
jmp    1205 <main+0xd5>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%rbx),%ebp
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    0xc(%rsp),%ebx
mov    %ebp,%ebx
jge    124b <main+0x11b>
mov    %ebx,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1210 <main+0xe0>
cmp    %ebx,0xc(%rsp)
jle    11f0 <main+0xc0>
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0xc(%rsp),%eax
sub    %ebx,%eax
add    %eax,%eax
cmp    %eax,%ebp
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 = [18 x i8] c"Number of lines: \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
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 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* %3)
%8 = load i32, i32* %3
%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* %3
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %43
14: ; preds = %10
store i32 1, i32* %2
br label %15
15: ; preds = %21, %14
%16 = load i32, i32* %2
%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* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
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* %2
br label %27
27: ; preds = %35, %24
%28 = load i32, i32* %2
%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* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
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 = %76, %43
%45 = load i32, i32* %4
%46 = load i32, i32* %3
%47 = icmp sle i32 %45, %46
br i1 %47, label %48, label %79
48: ; preds = %44
store i32 1, i32* %2
br label %49
49: ; preds = %55, %48
%50 = load i32, i32* %2
%51 = load i32, i32* %5
%52 = icmp sle i32 %50, %51
br i1 %52, label %53, label %58
53: ; preds = %49
%54 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %55
55: ; preds = %53
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %49
58: ; preds = %49
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 1
store i32 %60, i32* %5
store i32 1, i32* %2
br label %61
61: ; preds = %71, %58
%62 = load i32, i32* %2
%63 = load i32, i32* %3
%64 = load i32, i32* %4
%65 = sub nsw i32 %63, %64
%66 = mul nsw i32 2, %65
%67 = sub nsw i32 %66, 1
%68 = icmp sle i32 %62, %67
br i1 %68, label %69, label %74
69: ; preds = %61
%70 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %71
71: ; preds = %69
%72 = load i32, i32* %2
%73 = add nsw i32 %72, 1
store i32 %73, i32* %2
br label %61
74: ; preds = %61
%75 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %76
76: ; preds = %74
%77 = load i32, i32* %4
%78 = add nsw i32 %77, 1
store i32 %78, i32* %4
br label %44
79: ; preds = %44
%80 = load i32, i32* %1
ret i32 %80
}

LLVM IR (-O2):
@.str = [18 x i8] c"Number of lines: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 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 slt i32 %29, 1
br i1 %14, label %57, label %32
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 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 %34, %54
%56 = add nuw i32 %33, 1
br i1 %55, label %32, label %57
57: ; preds = %52, %0, %13
ret i32 0
}