#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, s, n, i;
  i = 0;
  printf("Enter rows: ");
  scanf("%d", &rows);
  if (rows < 0)
    printf("Enter a bigger number for a triangle. ;)");
  for (n = 1; n <= rows; n++) {
    for (s = 1; s <= rows - n; s++) {
      printf("  ");
    }
    while (i != 2 * n - 1) {
      printf(". ");
      i++;
    }
    i = 0;
    printf("\n");
    if (rows < 2)
      printf("Enter a bigger number for a prettier triangle. ;)");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    1168 <main+0x48>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     121c <main+0xfc>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jg     11ad <main+0x8d>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1182 <main+0x62>
jmp    11b2 <main+0x92>
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     11e0 <main+0xc0>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b2 <main+0x92>
movl   $0x0,-0x14(%rbp)
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jge    1209 <main+0xe9>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
jmp    120e <main+0xee>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116f <main+0x4f>
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    0xebf(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
js     1169 <main+0x39>
test   %eax,%eax
jg     1181 <main+0x51>
jmp    121e <main+0xee>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    121e <main+0xee>
mov    $0x1,%r12d
lea    0xeab(%rip),%r14
lea    0xea7(%rip),%r13
lea    0xea3(%rip),%r15
mov    $0x1,%ebp
jmp    11bd <main+0x8d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rbp),%ecx
add    $0x2,%r12d
cmp    %eax,%ebp
mov    %ecx,%ebp
jge    121e <main+0xee>
mov    %r12d,%ebx
cmp    %ebp,%eax
jle    11f0 <main+0xc0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x4(%rsp),%eax
sub    %ebp,%eax
add    $0x1,%ebx
cmp    %eax,%ebx
jl     11d0 <main+0xa0>
mov    %r12d,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    11f0 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
jg     11b0 <main+0x80>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0x4(%rsp),%eax
jmp    11b0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"Enter rows: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [41 x i8] c"Enter a bigger number for a triangle. ;)\00"
@.str.3 = [3 x i8] c" \00"
@.str.4 = [3 x i8] c". \00"
@.str.6 = [50 x i8] c"Enter a bigger number for a prettier triangle. ;)\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 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, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* %1
br label %10
10: ; preds = %7, %0
%11 = phi i32 [ %9, %7 ], [ %5, %0 ]
%12 = icmp slt i32 %11, 1
br i1 %12, label %43, label %13
13: ; preds = %10, %39
%14 = phi i32 [ %40, %39 ], [ %11, %10 ]
%15 = phi i32 [ %41, %39 ], [ 1, %10 ]
%16 = icmp sgt i32 %14, %15
br i1 %16, label %20, label %17
17: ; preds = %20, %13
%18 = shl nuw nsw i32 %15, 1
%19 = add nsw i32 %18, -1
br label %27
20: ; preds = %13, %20
%21 = phi i32 [ %23, %20 ], [ 1, %13 ]
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = add nuw nsw i32 %21, 1
%24 = load i32, i32* %1
%25 = sub nsw i32 %24, %15
%26 = icmp slt i32 %21, %25
br i1 %26, label %20, label %17
27: ; preds = %17, %27
%28 = phi i32 [ 0, %17 ], [ %30, %27 ]
%29 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%30 = add nuw nsw i32 %28, 1
%31 = icmp eq i32 %30, %19
br i1 %31, label %32, label %27
32: ; preds = %27
%33 = call i32 @putchar(i32 10)
%34 = load i32, i32* %1
%35 = icmp slt i32 %34, 2
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%38 = load i32, i32* %1
br label %39
39: ; preds = %32, %36
%40 = phi i32 [ %34, %32 ], [ %38, %36 ]
%41 = add nuw nsw i32 %15, 1
%42 = icmp slt i32 %15, %40
br i1 %42, label %13, label %43
43: ; preds = %39, %10
ret i32 0
}