#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 k, i, j, n;
  printf("how many line do you want to draw star:");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    for (k = n - i + 1; k >= 0; --k) {
      printf(" ");
    }
    for (j = 1; j <= 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    0xee6(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11d5 <main+0xb5>
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     118e <main+0x6e>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    116a <main+0x4a>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11bb <main+0x9b>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1195 <main+0x75>
lea    0xe6c(%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    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebp
test   %ebp,%ebp
jle    11cb <main+0x9b>
mov    $0x1,%r14d
lea    0xec2(%rip),%rbx
mov    $0x1,%r15d
nop
mov    %ebp,%eax
sub    %r15d,%eax
inc    %eax
js     118f <main+0x5f>
add    %r14d,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x50>
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
mov    0x4(%rsp),%ebp
add    $0xffffffff,%r14d
cmp    %r15d,%ebp
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 = [40 x i8] c"how many line do you want to draw star:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 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 ([40 x i8], [40 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 1, i32* %3
br label %8
8: ; preds = %37, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %40
12: ; preds = %8
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = sub nsw i32 %13, %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %17
17: ; preds = %22, %12
%18 = load i32, i32* %2
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17
%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* %2
%24 = add nsw i32 %23, -1
store i32 %24, i32* %2
br label %17
25: ; preds = %17
store i32 1, i32* %4
br label %26
26: ; preds = %32, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = icmp sle i32 %27, %28
br i1 %29, label %30, label %35
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 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* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %8
40: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"how many line do you want to draw star:\00"
@.str.1 = [3 x i8] c"%d\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 ([40 x i8], [40 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 %31, label %7
7: ; preds = %0, %25
%8 = phi i32 [ %30, %25 ], [ 2, %0 ]
%9 = phi i32 [ %28, %25 ], [ %5, %0 ]
%10 = phi i32 [ %27, %25 ], [ 1, %0 ]
%11 = sub nsw i32 1, %10
%12 = add i32 %11, %9
%13 = icmp sgt i32 %12, -1
br i1 %13, label %14, label %19
14: ; preds = %7, %14
%15 = phi i32 [ %17, %14 ], [ %12, %7 ]
%16 = call i32 @putchar(i32 32)
%17 = add nsw i32 %15, -1
%18 = icmp eq i32 %15, 0
br i1 %18, label %19, label %14
19: ; preds = %14, %7
br label %20
20: ; preds = %19, %20
%21 = phi i32 [ %23, %20 ], [ 1, %19 ]
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = add nuw i32 %21, 1
%24 = icmp eq i32 %23, %8
br i1 %24, label %25, label %20
25: ; preds = %20
%26 = call i32 @putchar(i32 10)
%27 = add nuw nsw i32 %10, 1
%28 = load i32, i32* %1
%29 = icmp sgt i32 %28, %10
%30 = add nuw i32 %8, 1
br i1 %29, label %7, label %31
31: ; preds = %25, %0
ret i32 0
}