#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*/ put_stars(char, int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int i, ln;
  printf("三角形有几层:");
  scanf("%d", &ln);
  for (i = 1; i <= ln; i++) {
    put_stars(' ', ln - i);
    put_stars('*', i);
    putchar('\n');
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11b3 <main+0x73>
mov    -0xc(%rbp),%esi
sub    -0x8(%rbp),%esi
mov    $0x20,%edi
call   1050 <put_stars@plt>
mov    -0x8(%rbp),%esi
mov    $0x2a,%edi
call   1050 <put_stars@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1172 <main+0x32>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11a0 <main+0x60>
xor    %ebx,%ebx
mov    $0xffffffff,%ebp
nop
add    $0x1,%ebx
add    %ebp,%esi
mov    $0x20,%edi
call   1050 <put_stars@plt>
mov    $0x2a,%edi
mov    %ebx,%esi
call   1050 <put_stars@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%esi
add    $0xffffffff,%ebp
cmp    %ebx,%esi
jg     1170 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\E4\B8\89\E8\A7\92\E5\BD\A2\E6\9C\89\E5\87\A0\E5\B1\82:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 1, i32* %2
br label %6
6: ; preds = %18, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = sub nsw i32 %11, %12
%14 = call i32 @put_stars(i8 signext 32, i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @put_stars(i8 signext 42, i32 %15)
%17 = call i32 @putchar(i8 signext 10)
br label %18
18: ; preds = %10
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %6
21: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"\E4\B8\89\E8\A7\92\E5\BD\A2\E6\9C\89\E5\87\A0\E5\B1\82:\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 ([20 x i8], [20 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 %17, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %15, %7 ], [ %5, %0 ]
%9 = phi i32 [ %14, %7 ], [ 1, %0 ]
%10 = sub nsw i32 %8, %9
%11 = call i32 @put_stars(i8 signext 32, i32 %10)
%12 = call i32 @put_stars(i8 signext 42, i32 %9)
%13 = call i32 @putchar(i8 signext 10)
%14 = add nuw nsw i32 %9, 1
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, %9
br i1 %16, label %7, label %17
17: ; preds = %7, %0
ret i32 0
}