#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 < i; j++) {
      printf("  ");
    }
    for (k = 0; k < ((num - i) * 2) - 1; 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    11dd <main+0xbd>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118b <main+0x6b>
lea    0xea7(%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
mov    -0x14(%rbp),%ecx
sub    -0x8(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11c3 <main+0xa3>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1192 <main+0x72>
lea    0xe5b(%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    11cc <main+0x9c>
xor    %ebp,%ebp
lea    0xebd(%rip),%r14
lea    0xeb3(%rip),%r15
jmp    1185 <main+0x55>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
jge    11cc <main+0x9c>
mov    %ebp,%ebx
test   %ebp,%ebp
je     11a1 <main+0x71>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    1190 <main+0x60>
mov    0x4(%rsp),%eax
cmp    %ebp,%eax
jle    1170 <main+0x40>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
sub    %ebp,%eax
add    %eax,%eax
add    $0xffffffff,%eax
cmp    %eax,%ebx
jl     11b0 <main+0x80>
jmp    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 = [3 x i8] c" \00"
@.str.3 = [3 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 = %38, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %41
12: ; preds = %8
store i32 0, i32* %3
br label %13
13: ; preds = %19, %12
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %13
22: ; preds = %13
store i32 0, i32* %4
br label %23
23: ; preds = %33, %22
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = load i32, i32* %2
%27 = sub nsw i32 %25, %26
%28 = mul nsw i32 %27, 2
%29 = sub nsw i32 %28, 1
%30 = icmp slt i32 %24, %29
br i1 %30, label %31, label %36
31: ; preds = %23
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %23
36: ; preds = %23
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %8
41: ; 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"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [3 x i8] c"* \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 %35
7: ; preds = %0, %30
%8 = phi i32 [ %33, %30 ], [ %5, %0 ]
%9 = phi i32 [ %32, %30 ], [ 0, %0 ]
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %16
11: ; preds = %16
%12 = load i32, i32* %1
br label %13
13: ; preds = %11, %7
%14 = phi i32 [ %12, %11 ], [ %8, %7 ]
%15 = icmp sgt i32 %14, %9
br i1 %15, label %21, label %30
16: ; preds = %7, %16
%17 = phi i32 [ %19, %16 ], [ 0, %7 ]
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = add nuw nsw i32 %17, 1
%20 = icmp eq i32 %19, %9
br i1 %20, label %11, label %16
21: ; preds = %13, %21
%22 = phi i32 [ %24, %21 ], [ 0, %13 ]
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%24 = add nuw nsw i32 %22, 1
%25 = load i32, i32* %1
%26 = sub nsw i32 %25, %9
%27 = shl nsw i32 %26, 1
%28 = add nsw i32 %27, -1
%29 = icmp slt i32 %24, %28
br i1 %29, label %21, label %30
30: ; preds = %21, %13
%31 = call i32 @putchar(i32 10)
%32 = add nuw nsw i32 %9, 1
%33 = load i32, i32* %1
%34 = icmp slt i32 %32, %33
br i1 %34, label %7, label %35
35: ; preds = %30, %0
ret i32 0
}