#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 cont;
  do {
    int num, i;
    do {
      printf("请输入一个非负整数");
      scanf("%d", &num);
      if (num < 0)
        puts("不要输入负数");
    } while (num < 0);
    for (i = 1; i <= num; i++)
      putchar('*');
    putchar('\n');
    printf("是否继续执行?[Yes...0/NO...9]:");
    scanf("%d", &cont);
  } while (!cont);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
jmp    1154 <main+0x14>
lea    0xea5(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jge    1186 <main+0x46>
lea    0xe9e(%rip),%rdi
call   1040 <puts@plt>
jmp    118b <main+0x4b>
cmpl   $0x0,-0xc(%rbp)
jl     1154 <main+0x14>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11c0 <main+0x80>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119c <main+0x5c>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe61(%rip),%rdi
call   1050 <printf@plt>
lea    0xe3f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    114f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%r14
lea    0xec3(%rip),%rbx
mov    %rsp,%r15
lea    0xebc(%rip),%r12
lea    0x4(%rsp),%rbp
jmp    11a0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeb7(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jne    11e6 <main+0xa6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
jns    11c9 <main+0x89>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    (%rsp),%eax
test   %eax,%eax
js     11a0 <main+0x60>
test   %eax,%eax
je     116a <main+0x2a>
xor    %r13d,%r13d
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
cmp    (%rsp),%r13d
jl     11d0 <main+0x90>
jmp    116a <main+0x2a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E9\9D\9E\E8\B4\9F\E6\95\B4\E6\95\B0\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"\E4\B8\8D\E8\A6\81\E8\BE\93\E5\85\A5\E8\B4\9F\E6\95\B0\00"
@.str.3 = [37 x i8] c"\E6\98\AF\E5\90\A6\E7\BB\A7\E7\BB\AD\E6\89\A7\E8\A1\8C?[Yes...0/NO...9]:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %31, %0
br label %6
6: ; preds = %14, %5
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %6
br label %14
14: ; preds = %13
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 0
br i1 %16, label %6, label %17
17: ; preds = %14
store i32 1, i32* %4
br label %18
18: ; preds = %24, %17
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = call i32 @putchar(i8 signext 42)
br label %24
24: ; preds = %22
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %18
27: ; preds = %18
%28 = call i32 @putchar(i8 signext 10)
%29 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %31
31: ; preds = %27
%32 = load i32, i32* %2
%33 = icmp ne i32 %32, 0
%34 = xor i1 %33, true
br i1 %34, label %5, label %35
35: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E9\9D\9E\E8\B4\9F\E6\95\B4\E6\95\B0\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"\E4\B8\8D\E8\A6\81\E8\BE\93\E5\85\A5\E8\B4\9F\E6\95\B0\00"
@.str.3 = [37 x i8] c"\E6\98\AF\E5\90\A6\E7\BB\A7\E7\BB\AD\E6\89\A7\E8\A1\8C?[Yes...0/NO...9]:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %24, %0
br label %6
6: ; preds = %11, %5
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %6, label %15
15: ; preds = %6, %11
%16 = phi i32 [ %13, %11 ], [ %9, %6 ]
%17 = icmp eq i32 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %15, %18
%19 = phi i32 [ %21, %18 ], [ 1, %15 ]
%20 = call i32 @putchar(i8 signext 42)
%21 = add nuw nsw i32 %19, 1
%22 = load i32, i32* %2
%23 = icmp slt i32 %19, %22
br i1 %23, label %18, label %24
24: ; preds = %18, %15
%25 = call i32 @putchar(i8 signext 10)
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%28 = load i32, i32* %1
%29 = icmp eq i32 %28, 0
br i1 %29, label %5, label %30
30: ; preds = %24
ret i32 0
}