#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*/ scanf(char *, int *);
int main() {
  int x = 0;
  int n = 1;
  double total = 0;
  double per = 0;
  int number[100];
  printf("请输入一些数：");
  scanf("%d", &x);
  while (x != 0) {
    number[n] = x;
    total += x;
    n++;
  }
  if (n > 0) {
    per = total / n;
    printf("平均数为：%f\n", per);
    printf("大于平均数的数为：");
    for (int i = 0; i <= n; i++) {
      if (number[n] > per) {
        printf("%d\t", number[i]);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11a3 <main+0x83>
mov    -0x8(%rbp),%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0x1b0(%rbp,%rax,4)
cvtsi2sdl -0x8(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116e <main+0x4e>
cmpl   $0x0,-0xc(%rbp)
jle    124c <main+0x12c>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe4d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1b4(%rbp)
mov    -0x1b4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1247 <main+0x127>
movslq -0xc(%rbp),%rax
cvtsi2sdl -0x1b0(%rbp,%rax,4),%xmm0
ff ff
ucomisd -0x20(%rbp),%xmm0
jbe    122e <main+0x10e>
movslq -0x1b4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1233 <main+0x113>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    11eb <main+0xcb>
jmp    124c <main+0x12c>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
lea    0xeca(%rip),%rdi
xorps  %xmm0,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\BA\9B\E6\95\B0\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"\E5\B9\B3\E5\9D\87\E6\95\B0\E4\B8\BA\EF\BC\9A%f\0A\00"
@.str.3 = [28 x i8] c"\E5\A4\A7\E4\BA\8E\E5\B9\B3\E5\9D\87\E6\95\B0\E7\9A\84\E6\95\B0\E4\B8\BA\EF\BC\9A\00"
@.str.4 = [4 x i8] c"%d\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca [100 x i32]
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %13, %0
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %16
store i32 %14, i32* %17
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to double
%20 = load double, double* %4
%21 = fadd double %20, %19
store double %21, double* %4
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %10
24: ; preds = %10
%25 = load i32, i32* %3
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %58
27: ; preds = %24
%28 = load double, double* %4
%29 = load i32, i32* %3
%30 = sitofp i32 %29 to double
%31 = fdiv double %28, %30
store double %31, double* %5
%32 = load double, double* %5
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %7
br label %35
35: ; preds = %54, %27
%36 = load i32, i32* %7
%37 = load i32, i32* %3
%38 = icmp sle i32 %36, %37
br i1 %38, label %39, label %57
39: ; preds = %35
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = sitofp i32 %43 to double
%45 = load double, double* %5
%46 = fcmp ogt double %44, %45
br i1 %46, label %47, label %53
47: ; preds = %39
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %47, %39
br label %54
54: ; preds = %53
%55 = load i32, i32* %7
%56 = add nsw i32 %55, 1
store i32 %56, i32* %7
br label %35
57: ; preds = %35
br label %58
58: ; preds = %57, %24
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\BA\9B\E6\95\B0\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"\E5\B9\B3\E5\9D\87\E6\95\B0\E4\B8\BA\EF\BC\9A%f\0A\00"
@.str.3 = [28 x i8] c"\E5\A4\A7\E4\BA\8E\E5\B9\B3\E5\9D\87\E6\95\B0\E7\9A\84\E6\95\B0\E4\B8\BA\EF\BC\9A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 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 eq i32 %5, 0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double 0.000000e+00)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}