#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 a[29], b[29], c[29];
  int i, j, d, e, f, sum1 = 0, sum2 = 0, sum3 = 0, k;
  double ave1, ave2, ave3;
  printf("»¶Ó­Ê¹ÓÃÃÈÃÃÖ½Ñ§Éú³É¼¨¹ÜÀí³ÌÐò¡«ß÷¡«\nÇëÊäÈëÈý¿Æ³É¼¨Ê±ÓÃ¿Õ¸ñ½«Æä·Ö¿ª£"
         "¬Ð»Ð»£¡\nÈçÑ§ÉúÊýÁ¿²»×ã30ÈË£¬ÇëÊäÈëÈý¸ö-1\n");
  printf("=================================================\n");
  for (i = 0; i <= 29; i++) {
    printf("ÇëÊäÈëÑ§ºÅÎª%dµÄÑ§ÉúµÄÈý¿Æ³É¼¨:", i + 1);
    scanf("%d%d%d", &d, &e, &f);
    if (d == -1 && e == -1 && f == -1)
      break;
    else
      a[i] = d, b[i] = e, c[i] = f;
  }
  printf("=================================================\n");
  printf("ÇëÊäÈëÑ§ºÅ£º");
  scanf("%d", &j);
  if (j <= i)
    printf("Ñ§ºÅÎª%dµÄÑ§Éú³É¼¨ÊÇ£º%d %d %d", j, a[j - 1], b[j - 1], c[j - 1]);
  else
    printf("Ñ§ºÅÊäÈë·Ç·¨£¬Çë¼ì²éºóÖØÆô³ÌÐò");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x198(%rbp)
movl   $0x0,-0x19c(%rbp)
movl   $0x0,-0x1a0(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x184(%rbp)
cmpl   $0x1d,-0x184(%rbp)
jg     123b <main+0x11b>
mov    -0x184(%rbp),%esi
add    $0x1,%esi
lea    0xf74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfa2(%rip),%rdi
lea    -0x18c(%rbp),%rsi
lea    -0x190(%rbp),%rdx
lea    -0x194(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x18c(%rbp)
jne    11e9 <main+0xc9>
cmpl   $0xffffffff,-0x190(%rbp)
jne    11e9 <main+0xc9>
cmpl   $0xffffffff,-0x194(%rbp)
jne    11e9 <main+0xc9>
jmp    123b <main+0x11b>
mov    -0x18c(%rbp),%ecx
movslq -0x184(%rbp),%rax
mov    %ecx,-0x80(%rbp,%rax,4)
mov    -0x190(%rbp),%ecx
movslq -0x184(%rbp),%rax
mov    %ecx,-0x100(%rbp,%rax,4)
mov    -0x194(%rbp),%ecx
movslq -0x184(%rbp),%rax
mov    %ecx,-0x180(%rbp,%rax,4)
jmp    1227 <main+0x107>
mov    -0x184(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x184(%rbp)
jmp    1176 <main+0x56>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf35(%rip),%rdi
lea    -0x188(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x188(%rbp),%eax
cmp    -0x184(%rbp),%eax
jg     12cb <main+0x1ab>
mov    -0x188(%rbp),%esi
mov    -0x188(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x80(%rbp,%rax,4),%edx
mov    -0x188(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x100(%rbp,%rax,4),%ecx
mov    -0x188(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x180(%rbp,%rax,4),%r8d
ff
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d9 <main+0x1b9>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x188,%rsp
lea    0xf84(%rip),%rdi
call   1030 <puts@plt>
lea    0x104b(%rip),%rdi
call   1030 <puts@plt>
lea    0xedc(%rip),%r15
lea    0x8(%rsp),%r12
lea    0x4(%rsp),%r13
mov    %rsp,%rbx
xor    %ebp,%ebp
jmp    119b <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,0x110(%rsp,%r14,4)
mov    %ecx,0x90(%rsp,%r14,4)
mov    %edx,0x10(%rsp,%r14,4)
cmp    $0x1e,%rbp
je     11e1 <main+0xb1>
mov    %rbp,%r14
add    $0x1,%rbp
lea    0xe57(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
mov    0x4(%rsp),%ecx
mov    (%rsp),%edx
cmp    $0xffffffff,%eax
jne    1180 <main+0x50>
cmp    $0xffffffff,%ecx
jne    1180 <main+0x50>
cmp    $0xffffffff,%edx
jne    1180 <main+0x50>
jmp    11e7 <main+0xb7>
mov    $0x1e,%r14d
lea    0xfb1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe84(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movslq 0xc(%rsp),%rsi
cmp    %r14d,%esi
jle    122e <main+0xfe>
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    124f <main+0x11f>
mov    0x10c(%rsp,%rsi,4),%edx
mov    0x8c(%rsp,%rsi,4),%ecx
mov    0xc(%rsp,%rsi,4),%r8d
lea    0xe14(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [212 x i8] c"\C2\BB\C2\B6\C3\93\C2\AD\C3\8A\C2\B9\C3\93\C3\83\C3\83\C3\88\C3\83\C3\83\C3\96\C2\BD\C3\91\C2\A7\C3\89\C3\BA\C2\B3\C3\89\C2\BC\C2\A8\C2\B9\C3\9C\C3\80\C3\AD\C2\B3\C3\8C\C3\90\C3\B2\C2\A1\C2\AB\C3\9F\C3\B7\C2\A1\C2\AB\0A\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\88\C3\BD\C2\BF\C3\86\C2\B3\C3\89\C2\BC\C2\A8\C3\8A\C2\B1\C3\93\C3\83\C2\BF\C3\95\C2\B8\C3\B1\C2\BD\C2\AB\C3\86\C3\A4\C2\B7\C3\96\C2\BF\C2\AA\C2\A3\C2\AC\C3\90\C2\BB\C3\90\C2\BB\C2\A3\C2\A1\0A\C3\88\C3\A7\C3\91\C2\A7\C3\89\C3\BA\C3\8A\C3\BD\C3\81\C2\BF\C2\B2\C2\BB\C3\97\C3\A330\C3\88\C3\8B\C2\A3\C2\AC\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\88\C3\BD\C2\B8\C3\B6-1\0A\00"
@.str.1 = [51 x i8] c"=================================================\0A\00"
@.str.2 = [60 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\91\C2\A7\C2\BA\C3\85\C3\8E\C2\AA%d\C2\B5\C3\84\C3\91\C2\A7\C3\89\C3\BA\C2\B5\C3\84\C3\88\C3\BD\C2\BF\C3\86\C2\B3\C3\89\C2\BC\C2\A8:\00"
@.str.3 = [7 x i8] c"%d%d%d\00"
@.str.4 = [25 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\91\C2\A7\C2\BA\C3\85\C2\A3\C2\BA\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [51 x i8] c"\C3\91\C2\A7\C2\BA\C3\85\C3\8E\C2\AA%d\C2\B5\C3\84\C3\91\C2\A7\C3\89\C3\BA\C2\B3\C3\89\C2\BC\C2\A8\C3\8A\C3\87\C2\A3\C2\BA%d %d %d\00"
@.str.7 = [61 x i8] c"\C3\91\C2\A7\C2\BA\C3\85\C3\8A\C3\A4\C3\88\C3\AB\C2\B7\C3\87\C2\B7\C2\A8\C2\A3\C2\AC\C3\87\C3\AB\C2\BC\C3\AC\C2\B2\C3\A9\C2\BA\C3\B3\C3\96\C3\98\C3\86\C3\B4\C2\B3\C3\8C\C3\90\C3\B2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [29 x i32]
%3 = alloca [29 x i32]
%4 = alloca [29 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
store i32 0, i32* %1
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([212 x i8], [212 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %19
19: ; preds = %50, %0
%20 = load i32, i32* %5
%21 = icmp sle i32 %20, 29
br i1 %21, label %22, label %53
22: ; preds = %19
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %7, i32* %8, i32* %9)
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %36
29: ; preds = %22
%30 = load i32, i32* %8
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32, i32* %9
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %36
35: ; preds = %32
br label %53
36: ; preds = %32, %29, %22
%37 = load i32, i32* %7
%38 = load i32, i32* %5
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [29 x i32], [29 x i32]* %2, i64 0, i64 %39
store i32 %37, i32* %40
%41 = load i32, i32* %8
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [29 x i32], [29 x i32]* %3, i64 0, i64 %43
store i32 %41, i32* %44
%45 = load i32, i32* %9
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [29 x i32], [29 x i32]* %4, i64 0, i64 %47
store i32 %45, i32* %48
br label %49
49: ; preds = %36
br label %50
50: ; preds = %49
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %19
53: ; preds = %35, %19
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%56 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %6)
%57 = load i32, i32* %6
%58 = load i32, i32* %5
%59 = icmp sle i32 %57, %58
br i1 %59, label %60, label %78
60: ; preds = %53
%61 = load i32, i32* %6
%62 = load i32, i32* %6
%63 = sub nsw i32 %62, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [29 x i32], [29 x i32]* %2, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = load i32, i32* %6
%68 = sub nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [29 x i32], [29 x i32]* %3, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = load i32, i32* %6
%73 = sub nsw i32 %72, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [29 x i32], [29 x i32]* %4, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 %61, i32 %66, i32 %71, i32 %76)
br label %80
78: ; preds = %53
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0))
br label %80
80: ; preds = %78, %60
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [60 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\91\C2\A7\C2\BA\C3\85\C3\8E\C2\AA%d\C2\B5\C3\84\C3\91\C2\A7\C3\89\C3\BA\C2\B5\C3\84\C3\88\C3\BD\C2\BF\C3\86\C2\B3\C3\89\C2\BC\C2\A8:\00"
@.str.3 = [7 x i8] c"%d%d%d\00"
@.str.4 = [25 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\91\C2\A7\C2\BA\C3\85\C2\A3\C2\BA\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [51 x i8] c"\C3\91\C2\A7\C2\BA\C3\85\C3\8E\C2\AA%d\C2\B5\C3\84\C3\91\C2\A7\C3\89\C3\BA\C2\B3\C3\89\C2\BC\C2\A8\C3\8A\C3\87\C2\A3\C2\BA%d %d %d\00"
@.str.7 = [61 x i8] c"\C3\91\C2\A7\C2\BA\C3\85\C3\8A\C3\A4\C3\88\C3\AB\C2\B7\C3\87\C2\B7\C2\A8\C2\A3\C2\AC\C3\87\C3\AB\C2\BC\C3\AC\C2\B2\C3\A9\C2\BA\C3\B3\C3\96\C3\98\C3\86\C3\B4\C2\B3\C3\8C\C3\90\C3\B2\00"
@str = [211 x i8] c"\C2\BB\C2\B6\C3\93\C2\AD\C3\8A\C2\B9\C3\93\C3\83\C3\83\C3\88\C3\83\C3\83\C3\96\C2\BD\C3\91\C2\A7\C3\89\C3\BA\C2\B3\C3\89\C2\BC\C2\A8\C2\B9\C3\9C\C3\80\C3\AD\C2\B3\C3\8C\C3\90\C3\B2\C2\A1\C2\AB\C3\9F\C3\B7\C2\A1\C2\AB\0A\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\88\C3\BD\C2\BF\C3\86\C2\B3\C3\89\C2\BC\C2\A8\C3\8A\C2\B1\C3\93\C3\83\C2\BF\C3\95\C2\B8\C3\B1\C2\BD\C2\AB\C3\86\C3\A4\C2\B7\C3\96\C2\BF\C2\AA\C2\A3\C2\AC\C3\90\C2\BB\C3\90\C2\BB\C2\A3\C2\A1\0A\C3\88\C3\A7\C3\91\C2\A7\C3\89\C3\BA\C3\8A\C3\BD\C3\81\C2\BF\C2\B2\C2\BB\C3\97\C3\A330\C3\88\C3\8B\C2\A3\C2\AC\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\88\C3\BD\C2\B8\C3\B6-1\00"
@str.9 = [50 x i8] c"=================================================\00"
define i32 @main() {
%1 = alloca [29 x i32]
%2 = alloca [29 x i32]
%3 = alloca [29 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast [29 x i32]* %1 to i8*
%9 = bitcast [29 x i32]* %2 to i8*
%10 = bitcast [29 x i32]* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([211 x i8], [211 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.9, i64 0, i64 0))
br label %17
17: ; preds = %0, %31
%18 = phi i64 [ 0, %0 ], [ %19, %31 ]
%19 = add nuw nsw i64 %18, 1
%20 = trunc i64 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %5, i32* %6, i32* %7)
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, -1
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, -1
%27 = select i1 %24, i1 %26, i1 false
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, -1
%30 = select i1 %27, i1 %29, i1 false
br i1 %30, label %36, label %31
31: ; preds = %17
%32 = getelementptr inbounds [29 x i32], [29 x i32]* %1, i64 0, i64 %18
store i32 %23, i32* %32
%33 = getelementptr inbounds [29 x i32], [29 x i32]* %2, i64 0, i64 %18
store i32 %25, i32* %33
%34 = getelementptr inbounds [29 x i32], [29 x i32]* %3, i64 0, i64 %18
store i32 %28, i32* %34
%35 = icmp eq i64 %19, 30
br i1 %35, label %38, label %17
36: ; preds = %17
%37 = trunc i64 %18 to i32
br label %38
38: ; preds = %31, %36
%39 = phi i32 [ %37, %36 ], [ 30, %31 ]
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.9, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%42 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%43 = load i32, i32* %4
%44 = icmp sgt i32 %43, %39
br i1 %44, label %55, label %45
45: ; preds = %38
%46 = add nsw i32 %43, -1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [29 x i32], [29 x i32]* %1, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = getelementptr inbounds [29 x i32], [29 x i32]* %2, i64 0, i64 %47
%51 = load i32, i32* %50
%52 = getelementptr inbounds [29 x i32], [29 x i32]* %3, i64 0, i64 %47
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 %43, i32 %49, i32 %51, i32 %53)
br label %57
55: ; preds = %38
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0))
br label %57
57: ; preds = %55, %45
ret i32 0
}