#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 (k = 0; k < i; k++) {
      printf(" ");
    }
    for (j = 0; j < num - i; j++) {
      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    11d7 <main+0xb7>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118b <main+0x6b>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1165 <main+0x45>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11bd <main+0x9d>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1192 <main+0x72>
lea    0xe5d(%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   %rbx
push   %rax
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11b9 <main+0x89>
xor    %ebx,%ebx
jmp    1175 <main+0x45>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    11b9 <main+0x89>
mov    %ebx,%ebp
test   %ebx,%ebx
je     1193 <main+0x63>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x50>
mov    0x4(%rsp),%eax
cmp    %ebx,%eax
jle    1160 <main+0x30>
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
sub    %ebx,%eax
cmp    %eax,%ebp
jl     11a0 <main+0x70>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
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 = %36, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %39
12: ; preds = %8
store i32 0, i32* %4
br label %13
13: ; preds = %19, %12
%14 = load i32, i32* %4
%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 ([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 0, i32* %3
br label %23
23: ; preds = %31, %22
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = load i32, i32* %2
%27 = sub nsw i32 %25, %26
%28 = icmp slt i32 %24, %27
br i1 %28, label %29, label %34
29: ; preds = %23
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %23
34: ; preds = %23
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %36
36: ; preds = %34
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %8
39: ; 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, %28
%8 = phi i32 [ %31, %28 ], [ %5, %0 ]
%9 = phi i32 [ %30, %28 ], [ 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 %28
16: ; preds = %7, %16
%17 = phi i32 [ %19, %16 ], [ 0, %7 ]
%18 = call i32 @putchar(i32 32)
%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 @putchar(i32 42)
%24 = add nuw nsw i32 %22, 1
%25 = load i32, i32* %1
%26 = sub nsw i32 %25, %9
%27 = icmp slt i32 %24, %26
br i1 %27, label %21, label %28
28: ; preds = %21, %13
%29 = call i32 @putchar(i32 10)
%30 = add nuw nsw i32 %9, 1
%31 = load i32, i32* %1
%32 = icmp slt i32 %30, %31
br i1 %32, label %7, label %33
33: ; preds = %28, %0
ret i32 0
}