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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11cf <main+0xaf>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1183 <main+0x63>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <main+0x3d>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    11b5 <main+0x95>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <main+0x6a>
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114b <main+0x2b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11ca <main+0x9a>
mov    $0x1,%r14d
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
cmp    %eax,%ebx
jge    1193 <main+0x63>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1180 <main+0x50>
mov    %r14d,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%ecx
mov    0xc(%rsp),%eax
add    $0x2,%r14d
cmp    %eax,%ebx
mov    %ecx,%ebx
jl     1170 <main+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
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 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
store i32 1, i32* %2
br label %7
7: ; preds = %35, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %38
11: ; preds = %7
%12 = load i32, i32* %2
store i32 %12, i32* %4
br label %13
13: ; preds = %19, %11
%14 = load i32, i32* %4
%15 = load i32, i32* %1
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %13
22: ; preds = %13
store i32 1, i32* %3
br label %23
23: ; preds = %30, %22
%24 = load i32, i32* %3
%25 = load i32, i32* %2
%26 = mul nsw i32 2, %25
%27 = icmp slt i32 %24, %26
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %23
33: ; preds = %23
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, 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 %7
38: ; preds = %7
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 slt i32 %5, 1
br i1 %6, label %30, label %7
7: ; preds = %0, %24
%8 = phi i32 [ %27, %24 ], [ %5, %0 ]
%9 = phi i32 [ %29, %24 ], [ 2, %0 ]
%10 = phi i32 [ %26, %24 ], [ 1, %0 ]
%11 = icmp slt i32 %10, %8
br i1 %11, label %12, label %18
12: ; preds = %7, %12
%13 = phi i32 [ %15, %12 ], [ %10, %7 ]
%14 = call i32 @putchar(i32 32)
%15 = add nuw nsw i32 %13, 1
%16 = load i32, i32* %1
%17 = icmp slt i32 %15, %16
br i1 %17, label %12, label %18
18: ; preds = %12, %7
br label %19
19: ; preds = %18, %19
%20 = phi i32 [ %22, %19 ], [ 1, %18 ]
%21 = call i32 @putchar(i32 42)
%22 = add nuw i32 %20, 1
%23 = icmp eq i32 %22, %9
br i1 %23, label %24, label %19
24: ; preds = %19
%25 = call i32 @putchar(i32 10)
%26 = add nuw nsw i32 %10, 1
%27 = load i32, i32* %1
%28 = icmp slt i32 %10, %27
%29 = add i32 %9, 2
br i1 %28, label %7, label %30
30: ; preds = %24, %0
ret void
}