#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(void) {
  int a[5][5] = {};
  int i, j;
  int row_total[5], col_total[5];
  for (i = 0; i < 5; i++) {
    printf("enter row %d: ", i + 1);
    for (j = 0; j < 5; j++) {
      scanf("%d", &a[i][j]);
      row_total[i] += a[i][j];
      col_total[j] += a[i][j];
    }
  }
  printf("row totals: ");
  for (i = 0; i < 5; i++) {
    printf("%d  ", row_total[i]);
  }
  printf("\n");
  printf("column totals: ");
  for (i = 0; i < 5; i++) {
    printf("%d  ", col_total[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    121f <main+0xef>
mov    -0x74(%rbp),%esi
add    $0x1,%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x78(%rbp)
cmpl   $0x5,-0x78(%rbp)
jge    120c <main+0xdc>
movslq -0x74(%rbp),%rax
lea    -0x70(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
movslq -0x78(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe66(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x74(%rbp),%rax
add    -0x90(%rbp,%rax,4),%ecx
mov    %ecx,-0x90(%rbp,%rax,4)
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x78(%rbp),%rax
add    -0xb0(%rbp,%rax,4),%ecx
mov    %ecx,-0xb0(%rbp,%rax,4)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    117e <main+0x4e>
jmp    1211 <main+0xe1>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1159 <main+0x29>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    1265 <main+0x135>
movslq -0x74(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%esi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1234 <main+0x104>
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    12b9 <main+0x189>
movslq -0x74(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%esi
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1288 <main+0x158>
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movl   $0x0,0x90(%rsp)
xor    %r13d,%r13d
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%r14),%rsi
mov    %rsi,0x28(%rsp)
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%r13,1),%rsi
add    $0x30,%rsi
lea    0xe69(%rip),%r12
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    0x30(%rsp,%r13,1),%eax
mov    0x10(%rsp,%r14,4),%r15d
add    %eax,%r15d
add    %eax,%ebx
lea    (%rsp,%r13,1),%rsi
add    $0x34,%rsi
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    0x34(%rsp,%r13,1),%eax
add    %eax,%r15d
add    %eax,0x4(%rsp)
lea    (%rsp,%r13,1),%rsi
add    $0x38,%rsi
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    0x38(%rsp,%r13,1),%eax
add    %eax,%r15d
add    %eax,0x8(%rsp)
lea    (%rsp,%r13,1),%rsi
add    $0x3c,%rsi
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    0x3c(%rsp,%r13,1),%eax
add    %eax,%r15d
add    %eax,0xc(%rsp)
lea    (%rsp,%r13,1),%rsi
add    $0x40,%rsi
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    0x40(%rsp,%r13,1),%eax
add    %eax,%r15d
mov    %r15d,0x10(%rsp,%r14,4)
add    %eax,%ebp
add    $0x14,%r13
mov    0x28(%rsp),%r14
cmp    $0x64,%r13
jne    1180 <main+0x50>
lea    0xdc8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xdc3(%rip),%r13
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd75(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"enter row %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"row totals: \00"
@.str.3 = [5 x i8] c"%d \00"
@.str.5 = [16 x i8] c"column totals: \00"
define i32 @main() {
%1 = alloca [5 x [5 x i32]]
%2 = alloca [5 x i32]
%3 = bitcast [5 x [5 x i32]]* %1 to i8*
%4 = bitcast [5 x i32]* %2 to i8*
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ undef, %0 ], [ %41, %5 ]
%7 = phi i32 [ undef, %0 ], [ %36, %5 ]
%8 = phi i32 [ undef, %0 ], [ %31, %5 ]
%9 = phi i32 [ undef, %0 ], [ %26, %5 ]
%10 = phi i32 [ undef, %0 ], [ %21, %5 ]
%11 = phi i64 [ 0, %0 ], [ %12, %5 ]
%12 = add nuw nsw i64 %11, 1
%13 = trunc i64 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %11
%16 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %11, i64 0
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %16
%19 = load i32, i32* %15
%20 = add nsw i32 %19, %18
%21 = add nsw i32 %10, %18
%22 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %11, i64 1
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = load i32, i32* %22
%25 = add nsw i32 %20, %24
%26 = add nsw i32 %9, %24
%27 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %11, i64 2
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %27)
%29 = load i32, i32* %27
%30 = add nsw i32 %25, %29
%31 = add nsw i32 %8, %29
%32 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %11, i64 3
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %32)
%34 = load i32, i32* %32
%35 = add nsw i32 %30, %34
%36 = add nsw i32 %7, %34
%37 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %11, i64 4
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %37)
%39 = load i32, i32* %37
%40 = add nsw i32 %35, %39
store i32 %40, i32* %15
%41 = add nsw i32 %6, %39
%42 = icmp eq i64 %12, 5
br i1 %42, label %43, label %5
43: ; preds = %5
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%45 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %49)
%51 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 3
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 4
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %58)
%60 = call i32 @putchar(i32 10)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %41)
%67 = call i32 @putchar(i32 10)
ret i32 0
}