#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 rows;
  int floor;
  int i = 1;
  int b = 0;
  int k = 0;
  int counter;
  printf("\nenter number of rows=");
  scanf("%d", &rows);
  floor = 2 * rows - 1;
  for (i = 1; i <= rows; i++) {
    counter = floor - k;
    while (b < counter) {
      printf(" ");
      printf("* ");
      b++;
    }
    printf("\n");
    b = 0;
    k = k + 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11e4 <main+0xc4>
mov    -0xc(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11ba <main+0x9a>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <main+0x68>
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1173 <main+0x53>
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    0xec9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%r14d
test   %r14d,%r14d
jle    11cb <main+0x9b>
add    %r14d,%r14d
lea    -0x1(%r14),%ebp
xor    %r15d,%r15d
mov    $0x1,%r12d
lea    0xea1(%rip),%r13
jmp    11a0 <main+0x70>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x2,%r15d
lea    0x1(%r12),%eax
add    $0xfffffffe,%ebp
cmp    0x4(%rsp),%r12d
mov    %eax,%r12d
jge    11cb <main+0x9b>
mov    %r15d,%eax
not    %eax
add    %r14d,%eax
test   %eax,%eax
jle    1180 <main+0x50>
xor    %ebx,%ebx
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    11b0 <main+0x80>
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 = [23 x i8] c"\0Aenter number of rows=\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 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
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = mul nsw i32 2, %10
%12 = sub nsw i32 %11, 1
store i32 %12, i32* %3
store i32 1, i32* %4
br label %13
13: ; preds = %34, %0
%14 = load i32, i32* %4
%15 = load i32, i32* %2
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %37
17: ; preds = %13
%18 = load i32, i32* %3
%19 = load i32, i32* %6
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %7
br label %21
21: ; preds = %25, %17
%22 = load i32, i32* %5
%23 = load i32, i32* %7
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %21
30: ; preds = %21
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %5
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 2
store i32 %33, i32* %6
br label %34
34: ; preds = %30
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %13
37: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0Aenter number of rows=\00"
@.str.1 = [3 x i8] c"%d\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 ([23 x i8], [23 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 = shl i32 %5, 1
%7 = icmp slt i32 %5, 1
br i1 %7, label %30, label %8
8: ; preds = %0
%9 = add i32 %6, -1
br label %10
10: ; preds = %8, %23
%11 = phi i32 [ %9, %8 ], [ %29, %23 ]
%12 = phi i32 [ 1, %8 ], [ %26, %23 ]
%13 = phi i32 [ 0, %8 ], [ %25, %23 ]
%14 = xor i32 %13, -1
%15 = add i32 %6, %14
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %10, %17
%18 = phi i32 [ %21, %17 ], [ 0, %10 ]
%19 = call i32 @putchar(i32 32)
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%21 = add nuw nsw i32 %18, 1
%22 = icmp eq i32 %21, %11
br i1 %22, label %23, label %17
23: ; preds = %17, %10
%24 = call i32 @putchar(i32 10)
%25 = add nuw nsw i32 %13, 2
%26 = add nuw nsw i32 %12, 1
%27 = load i32, i32* %1
%28 = icmp slt i32 %12, %27
%29 = add i32 %11, -2
br i1 %28, label %10, label %30
30: ; preds = %23, %0
ret i32 0
}