#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, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, arr[3][2], tally;
  printf("Please input %d elements for 'arr':\n", 3 * 2);
  for (i = 0; i < 3; i++) {
    printf("Row %d:\n", i + 1);
    for (j = 0; j < 2; j++) {
      scanf("%d", &arr[i][j]);
    }
  }
  for (i = 0; i < 3; i++) {
    tally = 0;
    for (j = 0; j < 2; j++) {
      tally += arr[i][j];
    }
    printf("Sum of Row %d: %d\n", i + 1, tally);
  }
  for (i = 0; i < 2; i++) {
    tally = 0;
    for (j = 0; j < 3; j++) {
      tally += arr[j][i];
    }
    printf("Sum of Column %d: %d\n", i + 1, tally);
  }
  tally = arr[0][0];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 2; j++) {
      if (tally < arr[i][j]) {
        tally = arr[i][j];
      }
    }
  }
  printf("Highest element is: %d\n", tally);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11bf <main+0x9f>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    11ac <main+0x8c>
movslq -0x8(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe95(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116e <main+0x4e>
jmp    11b1 <main+0x91>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x29>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1237 <main+0x117>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1212 <main+0xf2>
movslq -0x8(%rbp),%rcx
lea    -0x30(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11de <main+0xbe>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x34(%rbp),%edx
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c6 <main+0xa6>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    12af <main+0x18f>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    128a <main+0x16a>
movslq -0xc(%rbp),%rcx
lea    -0x30(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1256 <main+0x136>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x34(%rbp),%edx
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    123e <main+0x11e>
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1335 <main+0x215>
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1322 <main+0x202>
mov    -0x34(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    -0x30(%rbp),%rcx
shl    $0x3,%rdx
add    %rdx,%rcx
movslq -0xc(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    130f <main+0x1ef>
movslq -0x8(%rbp),%rcx
lea    -0x30(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
jmp    1314 <main+0x1f4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12cd <main+0x1ad>
jmp    1327 <main+0x207>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12bc <main+0x19c>
mov    -0x34(%rbp),%esi
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee4(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
add    (%rsp),%edx
lea    0xe62(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
add    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
add    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
add    (%rsp),%edx
add    0x10(%rsp),%edx
lea    0xe26(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
add    0x4(%rsp),%edx
add    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%eax
cmp    %eax,%esi
cmovl  %eax,%esi
mov    0x8(%rsp),%eax
cmp    %eax,%esi
cmovl  %eax,%esi
mov    0xc(%rsp),%eax
cmp    %eax,%esi
cmovl  %eax,%esi
mov    0x10(%rsp),%eax
cmp    %eax,%esi
cmovl  %eax,%esi
mov    0x14(%rsp),%eax
cmp    %eax,%esi
cmovl  %eax,%esi
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Please input %d elements for 'arr':\0A\00"
@.str.1 = [9 x i8] c"Row %d:\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"Sum of Row %d: %d\0A\00"
@.str.4 = [22 x i8] c"Sum of Column %d: %d\0A\00"
@.str.5 = [24 x i8] c"Highest element is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x [2 x i32]]
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 6)
store i32 0, i32* %2
br label %7
7: ; preds = %29, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %32
10: ; preds = %7
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %12)
store i32 0, i32* %3
br label %14
14: ; preds = %25, %10
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %4, i64 0, i64 %19
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %20, i64 0, i64 %22
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %14
28: ; preds = %14
br label %29
29: ; preds = %28
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %7
32: ; preds = %7
store i32 0, i32* %2
br label %33
33: ; preds = %58, %32
%34 = load i32, i32* %2
%35 = icmp slt i32 %34, 3
br i1 %35, label %36, label %61
36: ; preds = %33
store i32 0, i32* %5
store i32 0, i32* %3
br label %37
37: ; preds = %50, %36
%38 = load i32, i32* %3
%39 = icmp slt i32 %38, 2
br i1 %39, label %40, label %53
40: ; preds = %37
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %4, i64 0, i64 %42
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %43, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %5
%49 = add nsw i32 %48, %47
store i32 %49, i32* %5
br label %50
50: ; preds = %40
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %37
53: ; preds = %37
%54 = load i32, i32* %2
%55 = add nsw i32 %54, 1
%56 = load i32, i32* %5
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %55, i32 %56)
br label %58
58: ; preds = %53
%59 = load i32, i32* %2
%60 = add nsw i32 %59, 1
store i32 %60, i32* %2
br label %33
61: ; preds = %33
store i32 0, i32* %2
br label %62
62: ; preds = %87, %61
%63 = load i32, i32* %2
%64 = icmp slt i32 %63, 2
br i1 %64, label %65, label %90
65: ; preds = %62
store i32 0, i32* %5
store i32 0, i32* %3
br label %66
66: ; preds = %79, %65
%67 = load i32, i32* %3
%68 = icmp slt i32 %67, 3
br i1 %68, label %69, label %82
69: ; preds = %66
%70 = load i32, i32* %3
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %4, i64 0, i64 %71
%73 = load i32, i32* %2
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [2 x i32], [2 x i32]* %72, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = load i32, i32* %5
%78 = add nsw i32 %77, %76
store i32 %78, i32* %5
br label %79
79: ; preds = %69
%80 = load i32, i32* %3
%81 = add nsw i32 %80, 1
store i32 %81, i32* %3
br label %66
82: ; preds = %66
%83 = load i32, i32* %2
%84 = add nsw i32 %83, 1
%85 = load i32, i32* %5
%86 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %84, i32 %85)
br label %87
87: ; preds = %82
%88 = load i32, i32* %2
%89 = add nsw i32 %88, 1
store i32 %89, i32* %2
br label %62
90: ; preds = %62
%91 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %4, i64 0, i64 0
%92 = getelementptr inbounds [2 x i32], [2 x i32]* %91, i64 0, i64 0
%93 = load i32, i32* %92
store i32 %93, i32* %5
store i32 0, i32* %2
br label %94
94: ; preds = %124, %90
%95 = load i32, i32* %2
%96 = icmp slt i32 %95, 3
br i1 %96, label %97, label %127
97: ; preds = %94
store i32 0, i32* %3
br label %98
98: ; preds = %120, %97
%99 = load i32, i32* %3
%100 = icmp slt i32 %99, 2
br i1 %100, label %101, label %123
101: ; preds = %98
%102 = load i32, i32* %5
%103 = load i32, i32* %2
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %4, i64 0, i64 %104
%106 = load i32, i32* %3
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [2 x i32], [2 x i32]* %105, i64 0, i64 %107
%109 = load i32, i32* %108
%110 = icmp slt i32 %102, %109
br i1 %110, label %111, label %119
111: ; preds = %101
%112 = load i32, i32* %2
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %4, i64 0, i64 %113
%115 = load i32, i32* %3
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [2 x i32], [2 x i32]* %114, i64 0, i64 %116
%118 = load i32, i32* %117
store i32 %118, i32* %5
br label %119
119: ; preds = %111, %101
br label %120
120: ; preds = %119
%121 = load i32, i32* %3
%122 = add nsw i32 %121, 1
store i32 %122, i32* %3
br label %98
123: ; preds = %98
br label %124
124: ; preds = %123
%125 = load i32, i32* %2
%126 = add nsw i32 %125, 1
store i32 %126, i32* %2
br label %94
127: ; preds = %94
%128 = load i32, i32* %5
%129 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %128)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Please input %d elements for 'arr':\0A\00"
@.str.1 = [9 x i8] c"Row %d:\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"Sum of Row %d: %d\0A\00"
@.str.4 = [22 x i8] c"Sum of Column %d: %d\0A\00"
@.str.5 = [24 x i8] c"Highest element is: %d\0A\00"
define i32 @main() {
%1 = alloca [3 x [2 x i32]]
%2 = bitcast [3 x [2 x i32]]* %1 to i8*
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 6)
%4 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1)
%5 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %1, i64 0, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%7 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %1, i64 0, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 2)
%10 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %1, i64 0, i64 1, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %1, i64 0, i64 1, i64 1
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %12)
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 3)
%15 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %1, i64 0, i64 2, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %15)
%17 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %1, i64 0, i64 2, i64 1
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %17)
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = add nsw i32 %20, %19
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %21)
%23 = load i32, i32* %10
%24 = load i32, i32* %12
%25 = add nsw i32 %24, %23
%26 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 %25)
%27 = load i32, i32* %15
%28 = load i32, i32* %17
%29 = add nsw i32 %28, %27
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 %29)
%31 = load i32, i32* %5
%32 = load i32, i32* %10
%33 = add nsw i32 %32, %31
%34 = load i32, i32* %15
%35 = add nsw i32 %34, %33
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 %35)
%37 = load i32, i32* %7
%38 = load i32, i32* %12
%39 = add nsw i32 %38, %37
%40 = load i32, i32* %17
%41 = add nsw i32 %40, %39
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 %41)
%43 = load i32, i32* %5
%44 = load i32, i32* %7
%45 = icmp slt i32 %43, %44
%46 = select i1 %45, i32 %44, i32 %43
%47 = load i32, i32* %10
%48 = icmp slt i32 %46, %47
%49 = select i1 %48, i32 %47, i32 %46
%50 = load i32, i32* %12
%51 = icmp slt i32 %49, %50
%52 = select i1 %51, i32 %50, i32 %49
%53 = load i32, i32* %15
%54 = icmp slt i32 %52, %53
%55 = select i1 %54, i32 %53, i32 %52
%56 = load i32, i32* %17
%57 = icmp slt i32 %55, %56
%58 = select i1 %57, i32 %56, i32 %55
%59 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %58)
ret i32 0
}