#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 < i; j++) {
      putchar(' ');
    }
    for (; j < len; 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    120b <main+0xcb>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ca <main+0x8a>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <main+0x66>
jmp    11cf <main+0x8f>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f3 <main+0xb3>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11cf <main+0x8f>
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    11d5 <main+0x95>
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    11d5 <main+0x95>
mov    %ebx,%ebp
test   %ebx,%ebx
je     11b3 <main+0x73>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x60>
mov    0x4(%rsp),%eax
mov    %ebx,%ebp
cmp    %eax,%ebx
jge    1180 <main+0x40>
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     11c0 <main+0x80>
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\8F\B3\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 = %34, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %37
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 @putchar(i8 signext 32)
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
br label %23
23: ; preds = %29, %22
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = call i32 @putchar(i8 signext 42)
br label %29
29: ; preds = %27
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %23
32: ; preds = %23
%33 = call i32 @putchar(i8 signext 10)
br label %34
34: ; preds = %32
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
store i32 %36, i32* %2
br label %8
37: ; 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\8F\B3\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 %33
8: ; preds = %0, %28
%9 = phi i32 [ %31, %28 ], [ %6, %0 ]
%10 = phi i32 [ %30, %28 ], [ 0, %0 ]
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %17
12: ; preds = %17
%13 = load i32, i32* %1
br label %14
14: ; preds = %12, %8
%15 = phi i32 [ %9, %8 ], [ %13, %12 ]
%16 = icmp slt i32 %10, %15
br i1 %16, label %22, label %28
17: ; preds = %8, %17
%18 = phi i32 [ %20, %17 ], [ 0, %8 ]
%19 = call i32 @putchar(i8 signext 32)
%20 = add nuw nsw i32 %18, 1
%21 = icmp eq i32 %20, %10
br i1 %21, label %12, label %17
22: ; preds = %14, %22
%23 = phi i32 [ %25, %22 ], [ %10, %14 ]
%24 = call i32 @putchar(i8 signext 42)
%25 = add nuw nsw i32 %23, 1
%26 = load i32, i32* %1
%27 = icmp slt i32 %25, %26
br i1 %27, label %22, label %28
28: ; preds = %22, %14
%29 = call i32 @putchar(i8 signext 10)
%30 = add nuw nsw i32 %10, 1
%31 = load i32, i32* %1
%32 = icmp slt i32 %30, %31
br i1 %32, label %8, label %33
33: ; preds = %28, %0
ret i32 0
}