int main() {
  int x, y, z, a[5][3] = {0};
  for (y = 1; y <= 4; y++)
    for (x = 1; x <= 2; x++)
      scanf("%d", &z), a[0][0] += z, a[0][x] += z, a[y][0] += z;
  for (printf("가로평균 "), y = 0; y < 4 || 0 * printf("\n");
       printf("%d ", a[++y][0] / 2))
    ;
  for (printf("세로평균 "), x = 0; x < 2 || 0 * printf("\n");
       printf("%d ", a[0][++x] / 4))
    ;
  return 0 * printf("전체평균 %d\n", a[0][0] / 8);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x3c,%edx
call   1040 <memset@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jg     11d2 <main+0xa2>
movl   $0x1,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     11bf <main+0x8f>
lea    0xe88(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%eax
add    -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%ecx
movslq -0x8(%rbp),%rax
add    -0x50(%rbp,%rax,4),%ecx
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x10(%rbp),%ecx
movslq -0xc(%rbp),%rdx
lea    -0x50(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1167 <main+0x37>
jmp    11c4 <main+0x94>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <main+0x26>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x4,-0xc(%rbp)
mov    %al,-0x51(%rbp)
jl     1210 <main+0xe0>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
imul   $0x0,%eax,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    1220 <main+0xf0>
jmp    125b <main+0x12b>
jmp    1225 <main+0xf5>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movslq %eax,%rcx
lea    -0x50(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e7 <main+0xb7>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x2,-0x8(%rbp)
mov    %al,-0x52(%rbp)
jl     1299 <main+0x169>
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
imul   $0x0,%eax,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x52(%rbp)
mov    -0x52(%rbp),%al
test   $0x1,%al
jne    12a9 <main+0x179>
jmp    12da <main+0x1aa>
jmp    12ae <main+0x17e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cltq
mov    -0x50(%rbp,%rax,4),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1270 <main+0x140>
mov    -0x50(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
imul   $0x0,%eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xebb(%rip),%r13
lea    0xc(%rsp),%r14
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    (%rbx,%rax,1),%ebp
mov    %rbp,0x20(%rsp)
mov    %rax,%r15
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%r14d
lea    (%r14,%rbp,1),%r12d
add    %r14d,%ebx
mov    %r13,%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,%r12d
add    %eax,%r15d
mov    %r15,%rbp
add    %eax,%r14d
mov    %r13,%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%r15d
add    %r15d,%r12d
add    %r15d,%ebx
mov    %rbx,0x30(%rsp)
mov    %r13,%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    %eax,%r12d
add    %eax,%ebp
mov    %rbp,0x28(%rsp)
add    %eax,%r15d
mov    %r13,%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%r13d
add    %r13d,%r12d
lea    (%rbx,%r13,1),%ecx
mov    %ecx,0x14(%rsp)
lea    0xdec(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
lea    (%r12,%rbx,1),%eax
mov    %eax,0x1c(%rsp)
lea    (%rbx,%rbp,1),%eax
mov    %eax,0x18(%rsp)
lea    (%rbx,%r13,1),%eax
mov    %eax,0x10(%rsp)
lea    0xdc1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%rax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
lea    0xdb3(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,%esi
shr    $0x1f,%esi
add    %r14d,%esi
sar    %esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15d,%esi
shr    $0x1f,%esi
add    %r15d,%esi
sar    %esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd5b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x30(%rsp),%rax
lea    (%rax,%r13,1),%esi
add    $0x3,%esi
mov    0x14(%rsp),%eax
test   %eax,%eax
cmovns %eax,%esi
sar    $0x2,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%rax
lea    (%rbx,%rax,1),%esi
add    $0x3,%esi
mov    0x18(%rsp),%eax
test   %eax,%eax
cmovns %eax,%esi
sar    $0x2,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    (%rbx,%r12,1),%esi
add    $0x7,%esi
mov    0x1c(%rsp),%eax
test   %eax,%eax
cmovns %eax,%esi
sar    $0x3,%esi
lea    0xcfb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [14 x i8] c"\EA\B0\80\EB\A1\9C\ED\8F\89\EA\B7\A0 \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [14 x i8] c"\EC\84\B8\EB\A1\9C\ED\8F\89\EA\B7\A0 \00"
@.str.5 = [17 x i8] c"\EC\A0\84\EC\B2\B4\ED\8F\89\EA\B7\A0 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [5 x [3 x i32]]
store i32 0, i32* %1
%6 = bitcast [5 x [3 x i32]]* %5 to i8*
store i32 1, i32* %3
br label %7
7: ; preds = %39, %0
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 4
br i1 %9, label %10, label %42
10: ; preds = %7
store i32 1, i32* %2
br label %11
11: ; preds = %35, %10
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 2
br i1 %13, label %14, label %38
14: ; preds = %11
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%16 = load i32, i32* %4
%17 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 0
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 0
%19 = load i32, i32* %18
%20 = add nsw i32 %19, %16
store i32 %20, i32* %18
%21 = load i32, i32* %4
%22 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 0
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %22, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = add nsw i32 %26, %21
store i32 %27, i32* %25
%28 = load i32, i32* %4
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 %30
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %31, i64 0, i64 0
%33 = load i32, i32* %32
%34 = add nsw i32 %33, %28
store i32 %34, i32* %32
br label %35
35: ; preds = %14
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %11
38: ; preds = %11
br label %39
39: ; preds = %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %7
42: ; preds = %7
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %44
44: ; preds = %54, %42
%45 = load i32, i32* %3
%46 = icmp slt i32 %45, 4
br i1 %46, label %51, label %47
47: ; preds = %44
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%49 = mul nsw i32 0, %48
%50 = icmp ne i32 %49, 0
br label %51
51: ; preds = %47, %44
%52 = phi i1 [ true, %44 ], [ %50, %47 ]
br i1 %52, label %53, label %63
53: ; preds = %51
br label %54
54: ; preds = %53
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 %57
%59 = getelementptr inbounds [3 x i32], [3 x i32]* %58, i64 0, i64 0
%60 = load i32, i32* %59
%61 = sdiv i32 %60, 2
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %61)
br label %44
63: ; preds = %51
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %2
br label %65
65: ; preds = %75, %63
%66 = load i32, i32* %2
%67 = icmp slt i32 %66, 2
br i1 %67, label %72, label %68
68: ; preds = %65
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%70 = mul nsw i32 0, %69
%71 = icmp ne i32 %70, 0
br label %72
72: ; preds = %68, %65
%73 = phi i1 [ true, %65 ], [ %71, %68 ]
br i1 %73, label %74, label %84
74: ; preds = %72
br label %75
75: ; preds = %74
%76 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 0
%77 = load i32, i32* %2
%78 = add nsw i32 %77, 1
store i32 %78, i32* %2
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [3 x i32], [3 x i32]* %76, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = sdiv i32 %81, 4
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %82)
br label %65
84: ; preds = %72
%85 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 0
%86 = getelementptr inbounds [3 x i32], [3 x i32]* %85, i64 0, i64 0
%87 = load i32, i32* %86
%88 = sdiv i32 %87, 8
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %88)
%90 = mul nsw i32 0, %89
ret i32 %90
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [14 x i8] c"\EA\B0\80\EB\A1\9C\ED\8F\89\EA\B7\A0 \00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [14 x i8] c"\EC\84\B8\EB\A1\9C\ED\8F\89\EA\B7\A0 \00"
@.str.5 = [17 x i8] c"\EC\A0\84\EC\B2\B4\ED\8F\89\EA\B7\A0 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %4, %6
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = add nsw i32 %7, %9
%11 = add nsw i32 %4, %9
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = add nsw i32 %10, %13
%15 = add nsw i32 %6, %13
%16 = add nsw i32 %9, %13
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = add nsw i32 %14, %18
%20 = add nsw i32 %11, %18
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%22 = load i32, i32* %1
%23 = add nsw i32 %19, %22
%24 = add nsw i32 %15, %22
%25 = add nsw i32 %18, %22
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%27 = load i32, i32* %1
%28 = add nsw i32 %23, %27
%29 = add nsw i32 %20, %27
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%31 = load i32, i32* %1
%32 = add nsw i32 %28, %31
%33 = add nsw i32 %24, %31
%34 = add nsw i32 %27, %31
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%36 = sdiv i32 %7, 2
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = sdiv i32 %16, 2
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = sdiv i32 %25, 2
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = sdiv i32 %34, 2
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = call i32 @putchar(i32 10)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%46 = sdiv i32 %29, 4
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = sdiv i32 %33, 4
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %48)
%50 = call i32 @putchar(i32 10)
%51 = sdiv i32 %32, 8
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %51)
ret i32 0
}