#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 i, j, k, num;
  printf("enter the size of pattern: ");
  scanf("%d", &num);
  for (i = 0; i < num; i++) {
    for (j = 0; j <= num - i - 1; j++) {
      printf(" ");
    }
    for (k = 0; k <= i; k++) {
      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    0xeda(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11da <main+0xba>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1193 <main+0x73>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <main+0x45>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11c0 <main+0xa0>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119a <main+0x7a>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%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    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11ca <main+0x9a>
xor    %r15d,%r15d
mov    $0x1,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,%ebx
not    %ebx
add    %ebx,%eax
js     1197 <main+0x67>
mov    $0xffffffff,%ebp
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
add    %ebx,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     1180 <main+0x50>
mov    %r14d,%ebx
nopw   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>
add    $0x1,%r15d
mov    0x4(%rsp),%eax
add    $0x1,%r14d
cmp    %eax,%r15d
jl     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"enter the size of pattern: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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 %33
7: ; preds = %0, %27
%8 = phi i32 [ %30, %27 ], [ %5, %0 ]
%9 = phi i32 [ %32, %27 ], [ 1, %0 ]
%10 = phi i32 [ %29, %27 ], [ 0, %0 ]
%11 = xor i32 %10, -1
%12 = add i32 %8, %11
%13 = icmp slt i32 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %7, %14
%15 = phi i32 [ %17, %14 ], [ 0, %7 ]
%16 = call i32 @putchar(i32 32)
%17 = add nuw nsw i32 %15, 1
%18 = load i32, i32* %1
%19 = add i32 %18, %11
%20 = icmp slt i32 %15, %19
br i1 %20, label %14, label %21
21: ; preds = %14, %7
br label %22
22: ; preds = %21, %22
%23 = phi i32 [ %25, %22 ], [ 0, %21 ]
%24 = call i32 @putchar(i32 42)
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, %9
br i1 %26, label %27, label %22
27: ; preds = %22
%28 = call i32 @putchar(i32 10)
%29 = add nuw nsw i32 %10, 1
%30 = load i32, i32* %1
%31 = icmp slt i32 %29, %30
%32 = add nuw i32 %9, 1
br i1 %31, label %7, label %33
33: ; preds = %27, %0
ret i32 0
}