#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 width = 0, height = 0, t = 0, i = 0, j = 0;
  puts("让我们来画一个长方形");
  printf("一边: ");
  scanf("%d", &width);
  printf("另一边: ");
  scanf("%d", &height);
  if (width < height) {
    t = width;
    width = height;
    height = t;
  }
  for (i = 0; i < height; i++) {
    for (j = 0; j < width; j++) {
      putchar('*');
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe87(%rip),%rdi
call   1040 <puts@plt>
lea    0xea0(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe81(%rip),%rdi
call   1050 <printf@plt>
lea    0xe72(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d4 <main+0x94>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    122a <main+0xea>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1212 <main+0xd2>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ee <main+0xae>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11db <main+0x9b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xea7(%rip),%rdi
call   1040 <puts@plt>
lea    0xec0(%rip),%rdi
call   1050 <printf@plt>
lea    0xeae(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe9f(%rip),%rdi
call   1050 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    (%rsp),%ecx
mov    0x4(%rsp),%edx
cmp    %edx,%ecx
jge    11af <main+0x6f>
mov    %edx,(%rsp)
mov    %ecx,0x4(%rsp)
mov    %edx,%eax
test   %ecx,%ecx
jg     11b7 <main+0x77>
jmp    11fe <main+0xbe>
mov    %ecx,%eax
mov    %edx,%ecx
test   %ecx,%ecx
jle    11fe <main+0xbe>
xor    %ebx,%ebx
test   %eax,%eax
jle    11e2 <main+0xa2>
nopl   (%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    (%rsp),%ebp
jl     11d0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jge    11fe <main+0xbe>
mov    (%rsp),%eax
test   %eax,%eax
jg     11c0 <main+0x80>
jmp    11e2 <main+0xa2>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"\E8\AE\A9\E6\88\91\E4\BB\AC\E6\9D\A5\E7\94\BB\E4\B8\80\E4\B8\AA\E9\95\BF\E6\96\B9\E5\BD\A2\00"
@.str.1 = [9 x i8] c"\E4\B8\80\E8\BE\B9: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"\E5\8F\A6\E4\B8\80\E8\BE\B9: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %19
15: ; preds = %0
%16 = load i32, i32* %2
store i32 %16, i32* %4
%17 = load i32, i32* %3
store i32 %17, i32* %2
%18 = load i32, i32* %4
store i32 %18, i32* %3
br label %19
19: ; preds = %15, %0
store i32 0, i32* %5
br label %20
20: ; preds = %36, %19
%21 = load i32, i32* %5
%22 = load i32, i32* %3
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %39
24: ; preds = %20
store i32 0, i32* %6
br label %25
25: ; preds = %31, %24
%26 = load i32, i32* %6
%27 = load i32, i32* %2
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = call i32 @putchar(i8 signext 42)
br label %31
31: ; preds = %29
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %25
34: ; preds = %25
%35 = call i32 @putchar(i8 signext 10)
br label %36
36: ; preds = %34
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %20
39: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"\E8\AE\A9\E6\88\91\E4\BB\AC\E6\9D\A5\E7\94\BB\E4\B8\80\E4\B8\AA\E9\95\BF\E6\96\B9\E5\BD\A2\00"
@.str.1 = [9 x i8] c"\E4\B8\80\E8\BE\B9: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"\E5\8F\A6\E4\B8\80\E8\BE\B9: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) 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* %1)
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %0
store i32 %11, i32* %1
store i32 %10, i32* %2
br label %14
14: ; preds = %13, %0
%15 = phi i32 [ %11, %13 ], [ %10, %0 ]
%16 = phi i32 [ %10, %13 ], [ %11, %0 ]
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %35
18: ; preds = %14, %33
%19 = phi i32 [ %34, %33 ], [ %15, %14 ]
%20 = phi i32 [ %30, %33 ], [ 0, %14 ]
%21 = icmp sgt i32 %19, 0
br i1 %21, label %22, label %28
22: ; preds = %18, %22
%23 = phi i32 [ %25, %22 ], [ 0, %18 ]
%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, %18
%29 = call i32 @putchar(i8 signext 10)
%30 = add nuw nsw i32 %20, 1
%31 = load i32, i32* %2
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = load i32, i32* %1
br label %18
35: ; preds = %28, %14
ret i32 0
}