#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, i, j, k;
  printf("pelease input a number: ");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    for (k = 1; k <= n - i; k++) {
      printf(" ");
    }
    if (i == 1 || i == n) {
      for (j = 1; j <= i * 2 - 1; j++) {
        printf("*");
      }
    } else {
      for (j = 1; j <= i * 2 - 1; j++) {
        if (j == 1 || j == i * 2 - 1) {
          printf("*");
        } else
          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    0xed7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1268 <main+0x148>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     1190 <main+0x70>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <main+0x45>
cmpl   $0x1,-0xc(%rbp)
je     11a6 <main+0x86>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11e0 <main+0xc0>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11db <main+0xbb>
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ad <main+0x8d>
jmp    124e <main+0x12e>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1249 <main+0x129>
cmpl   $0x1,-0x10(%rbp)
je     1219 <main+0xf9>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    122a <main+0x10a>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
jmp    1236 <main+0x116>
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
jmp    123b <main+0x11b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11e7 <main+0xc7>
jmp    124e <main+0x12e>
lea    0xdc9(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <main+0x32>
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    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1234 <main+0x104>
xor    %r12d,%r12d
mov    $0x1,%r14d
mov    $0x2a,%r15d
mov    $0x1,%r13d
jmp    11a6 <main+0x76>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r13),%ecx
mov    0x4(%rsp),%eax
add    $0x2,%r12d
add    $0x2,%r14d
cmp    %eax,%r13d
mov    %ecx,%r13d
jge    1234 <main+0x104>
cmp    %r13d,%eax
jle    11ca <main+0x9a>
xor    %ebx,%ebx
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ecx
sub    %r13d,%ecx
add    $0x1,%ebx
cmp    %ecx,%ebx
jl     11b0 <main+0x80>
mov    %r14d,%ebx
cmp    $0x1,%r13d
je     1220 <main+0xf0>
mov    %r14d,%ebx
cmp    %r13d,%eax
je     1220 <main+0xf0>
lea    0x1(%r12),%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %ebp,%r12d
mov    $0x20,%edi
cmove  %r15d,%edi
test   %ebp,%ebp
cmove  %r15d,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11f0 <main+0xc0>
jmp    1180 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1220 <main+0xf0>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [25 x i8] c"pelease input a number: \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 ([25 x i8], [25 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 %47, label %7
7: ; preds = %0, %41
%8 = phi i32 [ %44, %41 ], [ %5, %0 ]
%9 = phi i32 [ %46, %41 ], [ 2, %0 ]
%10 = phi i32 [ %43, %41 ], [ 1, %0 ]
%11 = icmp sgt i32 %8, %10
br i1 %11, label %12, label %19
12: ; preds = %7, %12
%13 = phi i32 [ %15, %12 ], [ 1, %7 ]
%14 = call i32 @putchar(i32 32)
%15 = add nuw nsw i32 %13, 1
%16 = load i32, i32* %1
%17 = sub nsw i32 %16, %10
%18 = icmp slt i32 %13, %17
br i1 %18, label %12, label %19
19: ; preds = %12, %7
%20 = phi i32 [ %8, %7 ], [ %16, %12 ]
%21 = icmp eq i32 %10, 1
%22 = icmp eq i32 %20, %10
%23 = select i1 %21, i1 true, i1 %22
br i1 %23, label %27, label %24
24: ; preds = %19
%25 = shl nuw nsw i32 %10, 1
%26 = add nsw i32 %25, -1
br label %32
27: ; preds = %19, %27
%28 = phi i32 [ %30, %27 ], [ 1, %19 ]
%29 = call i32 @putchar(i32 42)
%30 = add nuw i32 %28, 1
%31 = icmp eq i32 %30, %9
br i1 %31, label %41, label %27
32: ; preds = %24, %32
%33 = phi i32 [ 1, %24 ], [ %39, %32 ]
%34 = icmp eq i32 %33, 1
%35 = icmp eq i32 %33, %26
%36 = select i1 %34, i1 true, i1 %35
%37 = select i1 %36, i32 42, i32 32
%38 = call i32 @putchar(i32 %37)
%39 = add nuw i32 %33, 1
%40 = icmp eq i32 %39, %9
br i1 %40, label %41, label %32
41: ; preds = %32, %27
%42 = call i32 @putchar(i32 10)
%43 = add nuw nsw i32 %10, 1
%44 = load i32, i32* %1
%45 = icmp slt i32 %10, %44
%46 = add i32 %9, 2
br i1 %45, label %7, label %47
47: ; preds = %41, %0
ret i32 0
}