#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, i, i2, a, m;
  printf("How many rows?\n");
  scanf("%d", &rows);
  for (i = 1; i <= rows; i++) {
    m = rows - i;
    a = 0;
    while (a <= m) {
      a++;
      printf(" ");
    }
    for (i2 = 1; i2 <= 2 * i - 1; i2++)
      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    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11e3 <main+0xc3>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1194 <main+0x74>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
jmp    116e <main+0x4e>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11c9 <main+0xa9>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119b <main+0x7b>
lea    0xe3e(%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   %rbx
push   %rax
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
test   %ebx,%ebx
jle    11d0 <main+0xa0>
xor    %r14d,%r14d
mov    $0x1,%ebp
mov    $0x1,%r15d
nopw   0x0(%rax,%rax,1)
cmp    %r15d,%ebx
jl     118f <main+0x5f>
add    %r14d,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1180 <main+0x50>
mov    %ebp,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
mov    0x4(%rsp),%ebx
add    $0xffffffff,%r14d
add    $0x2,%ebp
cmp    %r15d,%ebx
mov    %eax,%r15d
jg     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"How many rows?\0A\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
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 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* %2)
store i32 1, i32* %3
br label %9
9: ; preds = %39, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %42
13: ; preds = %9
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = sub nsw i32 %14, %15
store i32 %16, i32* %6
store i32 0, i32* %5
br label %17
17: ; preds = %21, %13
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %17
25: ; preds = %17
store i32 1, i32* %4
br label %26
26: ; preds = %34, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = mul nsw i32 2, %28
%30 = sub nsw i32 %29, 1
%31 = icmp sle i32 %27, %30
br i1 %31, label %32, label %37
32: ; preds = %26
%33 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %26
37: ; preds = %26
%38 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %37
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %9
42: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [15 x i8] c"How many rows?\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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 %33, label %7
7: ; preds = %0, %26
%8 = phi i32 [ %32, %26 ], [ 2, %0 ]
%9 = phi i32 [ %31, %26 ], [ 0, %0 ]
%10 = phi i32 [ %29, %26 ], [ %5, %0 ]
%11 = phi i32 [ %28, %26 ], [ 1, %0 ]
%12 = icmp slt i32 %10, %11
br i1 %12, label %20, label %13
13: ; preds = %7
%14 = add i32 %10, %9
br label %15
15: ; preds = %13, %15
%16 = phi i32 [ %17, %15 ], [ 0, %13 ]
%17 = add nuw i32 %16, 1
%18 = call i32 @putchar(i32 32)
%19 = icmp eq i32 %17, %14
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 %11, 1
%29 = load i32, i32* %1
%30 = icmp sgt i32 %29, %11
%31 = add i32 %9, -1
%32 = add i32 %8, 2
br i1 %30, label %7, label %33
33: ; preds = %26, %0
ret i32 0
}