#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 *);
void main(void) {
  int numrows, i, j, k, maxstars, rowstars;
  printf("Enter number of rows: ");
  scanf("%d", &numrows);
  maxstars = 2 * (numrows - 1) + 1;
  for (i = 0; i < numrows; i++) {
    rowstars = 2 * i + 1;
    for (k = 0; k < (maxstars - rowstars) / 2; k++)
      printf(" ");
    for (j = 0; j < 2 * i + 1; j++) {
      printf("*");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1203 <main+0xe3>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    11b4 <main+0x94>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1179 <main+0x59>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11e9 <main+0xc9>
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bb <main+0x9b>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115a <main+0x3a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%r14d
test   %r14d,%r14d
jle    11c6 <main+0x96>
xor    %ebx,%ebx
mov    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%ebp
not    %ebp
add    %r14d,%ebp
add    %ebp,%ebp
cmp    $0x2,%ebp
jl     118f <main+0x5f>
sar    %ebp
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x50>
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
add    $0x2,%r15d
cmp    0x4(%rsp),%ebx
jl     1170 <main+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter number of rows: \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 void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = sub nsw i32 %9, 1
%11 = mul nsw i32 2, %10
%12 = add nsw i32 %11, 1
store i32 %12, i32* %5
store i32 0, i32* %2
br label %13
13: ; preds = %47, %0
%14 = load i32, i32* %2
%15 = load i32, i32* %1
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %50
17: ; preds = %13
%18 = load i32, i32* %2
%19 = mul nsw i32 2, %18
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
store i32 0, i32* %4
br label %21
21: ; preds = %30, %17
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = sub nsw i32 %23, %24
%26 = sdiv i32 %25, 2
%27 = icmp slt i32 %22, %26
br i1 %27, label %28, label %33
28: ; preds = %21
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %21
33: ; preds = %21
store i32 0, i32* %3
br label %34
34: ; preds = %42, %33
%35 = load i32, i32* %3
%36 = load i32, i32* %2
%37 = mul nsw i32 2, %36
%38 = add nsw i32 %37, 1
%39 = icmp slt i32 %35, %38
br i1 %39, label %40, label %45
40: ; preds = %34
%41 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %34
45: ; preds = %34
%46 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %47
47: ; preds = %45
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %2
br label %13
50: ; preds = %13
ret void
}

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