#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*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int i = 0;
  int j = 0;
  int len = 0;
  puts("生成直角在左上方的等腰直角三角形");
  printf("短边: ");
  scanf("%d", &len);
  for (i = 0; i < len; i++) {
    for (j = 0; j < len - i; j++) {
      putchar('*');
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe95(%rip),%rdi
call   1040 <puts@plt>
lea    0xeba(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11e7 <main+0xa7>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11cf <main+0x8f>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <main+0x66>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1193 <main+0x53>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeae(%rip),%rdi
call   1040 <puts@plt>
lea    0xed3(%rip),%rdi
call   1050 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11b9 <main+0x79>
xor    %ebx,%ebx
jmp    1195 <main+0x55>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    11b9 <main+0x79>
cmp    %ebx,%eax
jle    1180 <main+0x40>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
sub    %ebx,%eax
cmp    %eax,%ebp
jl     11a0 <main+0x60>
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"\E7\94\9F\E6\88\90\E7\9B\B4\E8\A7\92\E5\9C\A8\E5\B7\A6\E4\B8\8A\E6\96\B9\E7\9A\84\E7\AD\89\E8\85\B0\E7\9B\B4\E8\A7\92\E4\B8\89\E8\A7\92\E5\BD\A2\00"
@.str.1 = [9 x i8] c"\E7\9F\AD\E8\BE\B9: \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
store i32 0, i32* %2
br label %8
8: ; preds = %26, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %29
12: ; preds = %8
store i32 0, i32* %3
br label %13
13: ; preds = %21, %12
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = load i32, i32* %2
%17 = sub nsw i32 %15, %16
%18 = icmp slt i32 %14, %17
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = call i32 @putchar(i8 signext 42)
br label %21
21: ; preds = %19
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %13
24: ; preds = %13
%25 = call i32 @putchar(i8 signext 10)
br label %26
26: ; preds = %24
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %8
29: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"\E7\94\9F\E6\88\90\E7\9B\B4\E8\A7\92\E5\9C\A8\E5\B7\A6\E4\B8\8A\E6\96\B9\E7\9A\84\E7\AD\89\E8\85\B0\E7\9B\B4\E8\A7\92\E4\B8\89\E8\A7\92\E5\BD\A2\00"
@.str.1 = [9 x i8] c"\E7\9F\AD\E8\BE\B9: \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %0, %19
%9 = phi i32 [ %22, %19 ], [ %6, %0 ]
%10 = phi i32 [ %21, %19 ], [ 0, %0 ]
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8, %12
%13 = phi i32 [ %15, %12 ], [ 0, %8 ]
%14 = call i32 @putchar(i8 signext 42)
%15 = add nuw nsw i32 %13, 1
%16 = load i32, i32* %1
%17 = sub nsw i32 %16, %10
%18 = icmp slt i32 %15, %17
br i1 %18, label %12, label %19
19: ; preds = %12, %8
%20 = call i32 @putchar(i8 signext 10)
%21 = add nuw nsw i32 %10, 1
%22 = load i32, i32* %1
%23 = icmp slt i32 %21, %22
br i1 %23, label %8, label %24
24: ; preds = %19, %0
ret i32 0
}