#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 */
typedef int /*<<< orphan*/ m3;
typedef int /*<<< orphan*/ a2;
typedef int /*<<< orphan*/ a1;

/* Variables and functions */
int /*<<< orphan*/ arr_avg(int *, int);
int /*<<< orphan*/ arr_diagonal_sum(int *, int, int);
int arr_max(int *, int);
int arr_min(int *, int);
int /*<<< orphan*/ arr_subdiagonal_sum(int *, int, int);
int /*<<< orphan*/ arr_sum(int *, int);
size_t mat_to_arr(int, int, int);
int /*<<< orphan*/ place_negatives_first(int *, int);
int /*<<< orphan*/ print_n_min(int *, int, int);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ swap_ext_rows(int *, int, int);
int main(void) {
  int a1[] = {3, 4, 5, 6, 7, -1, -6, 19, 8, 9, 15, -4, 3, 3, 10, 11, 12};
  int a2[] = {-1, 1,  40, -2, 3, 4, -7, 4, -9, 5, 6,
              2,  -1, -1, -1, 1, 1, 1,  1, -1, 1, 1};
  int m3[] = {
      -4, 3, 2, 1, 5, 6, -8, -8, 33, 3, 3, 1, -4, -4, -4, -4,
  };
  puts("Task 1");
  for (unsigned int i = 0; i < (sizeof(a1) / sizeof((a1)[0])); i++)
    printf("%d ", a1[i]);
  puts("");
  print_n_min(a1, (sizeof(a1) / sizeof((a1)[0])), 5);
  puts("\n");
  puts("Task 2");
  place_negatives_first(a2, (sizeof(a2) / sizeof((a2)[0])));
  for (unsigned int i = 0; i < (sizeof(a2) / sizeof((a2)[0])); i++)
    printf("%d ", a2[i]);
  puts("\n");
  puts("Matrix:");
  for (int i = 1; i <= 4; i++) {
    for (int j = 1; j <= 4; j++)
      printf("%d\t", m3[mat_to_arr(i, j, 4)]);
    puts("");
  }
  puts("");
  puts("Task 3");
  printf("Min: %d, max: %d, avg: %lf, sum: %lld, mdsum: %lld, sdsum: %lld\n\n",
         arr_min(m3, (sizeof(m3) / sizeof((m3)[0]))),
         arr_max(m3, (sizeof(m3) / sizeof((m3)[0]))),
         arr_avg(m3, (sizeof(m3) / sizeof((m3)[0]))),
         arr_sum(m3, (sizeof(m3) / sizeof((m3)[0]))),
         arr_diagonal_sum(m3, 4, (sizeof(m3) / sizeof((m3)[0]))),
         arr_subdiagonal_sum(m3, 4, (sizeof(m3) / sizeof((m3)[0]))));
  puts("Task 4");
  swap_ext_rows(m3, 4, 4);
  puts("Matrix:");
  for (int i = 1; i <= 4; i++) {
    for (int j = 1; j <= 4; j++)
      printf("%d\t", m3[mat_to_arr(i, j, 4)]);
    puts("");
  }
  puts("");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe13(%rip),%rsi
mov    $0x44,%edx
call   1070 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x58,%edx
call   1070 <memcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x40,%edx
call   1070 <memcpy@plt>
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0xf4(%rbp)
mov    -0xf4(%rbp),%eax
cmp    $0x11,%rax
jae    1279 <main+0xa9>
mov    -0xf4(%rbp),%eax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
jmp    123d <main+0x6d>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
lea    -0x50(%rbp),%rdi
mov    $0x11,%esi
mov    $0x5,%edx
call   1050 <print_n_min@plt>
lea    0xeb6(%rip),%rdi
call   1040 <puts@plt>
lea    0xe50(%rip),%rdi
call   1040 <puts@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x16,%esi
call   1090 <place_negatives_first@plt>
movl   $0x0,-0xf8(%rbp)
mov    -0xf8(%rbp),%eax
cmp    $0x16,%rax
jae    130a <main+0x13a>
mov    -0xf8(%rbp),%eax
mov    -0xb0(%rbp,%rax,4),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xf8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf8(%rbp)
jmp    12cb <main+0xfb>
lea    0xe44(%rip),%rdi
call   1040 <puts@plt>
lea    0xde5(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0xfc(%rbp)
cmpl   $0x4,-0xfc(%rbp)
jg     13af <main+0x1df>
movl   $0x1,-0x100(%rbp)
cmpl   $0x4,-0x100(%rbp)
jg     138f <main+0x1bf>
mov    -0xfc(%rbp),%edi
mov    -0x100(%rbp),%esi
mov    $0x4,%edx
call   1030 <mat_to_arr@plt>
mov    -0xf0(%rbp,%rax,4),%esi
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x100(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x100(%rbp)
jmp    1343 <main+0x173>
lea    0xd77(%rip),%rdi
call   1040 <puts@plt>
mov    -0xfc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc(%rbp)
jmp    132c <main+0x15c>
lea    0xd57(%rip),%rdi
call   1040 <puts@plt>
lea    0xd4c(%rip),%rdi
call   1040 <puts@plt>
lea    -0xf0(%rbp),%rdi
mov    $0x10,%esi
call   10b0 <arr_min@plt>
mov    %eax,-0x11c(%rbp)
lea    -0xf0(%rbp),%rdi
mov    $0x10,%esi
call   10d0 <arr_max@plt>
mov    %eax,-0x118(%rbp)
lea    -0xf0(%rbp),%rdi
mov    $0x10,%esi
call   10a0 <arr_avg@plt>
mov    %eax,-0x114(%rbp)
lea    -0xf0(%rbp),%rdi
mov    $0x10,%esi
call   10e0 <arr_sum@plt>
mov    %eax,-0x110(%rbp)
lea    -0xf0(%rbp),%rdi
mov    $0x4,%esi
mov    $0x10,%edx
call   1080 <arr_diagonal_sum@plt>
mov    %eax,-0x10c(%rbp)
lea    -0xf0(%rbp),%rdi
mov    $0x4,%esi
mov    $0x10,%edx
call   10c0 <arr_subdiagonal_sum@plt>
mov    -0x11c(%rbp),%esi
mov    -0x118(%rbp),%edx
mov    -0x114(%rbp),%ecx
mov    -0x110(%rbp),%r8d
mov    -0x10c(%rbp),%r9d
lea    0xc99(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xcca(%rip),%rdi
call   1040 <puts@plt>
lea    -0xf0(%rbp),%rdi
mov    $0x4,%edx
mov    %edx,%esi
call   10f0 <swap_ext_rows@plt>
lea    0xc56(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x104(%rbp)
cmpl   $0x4,-0x104(%rbp)
jg     153e <main+0x36e>
movl   $0x1,-0x108(%rbp)
cmpl   $0x4,-0x108(%rbp)
jg     151e <main+0x34e>
mov    -0x104(%rbp),%edi
mov    -0x108(%rbp),%esi
mov    $0x4,%edx
call   1030 <mat_to_arr@plt>
mov    -0xf0(%rbp,%rax,4),%esi
lea    0xc07(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x108(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x108(%rbp)
jmp    14d2 <main+0x302>
lea    0xbe8(%rip),%rdi
call   1040 <puts@plt>
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    14bb <main+0x2eb>
lea    0xbc8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    0xe59(%rip),%eax
mov    %eax,0xf0(%rsp)
movaps 0xe3b(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xe1c(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xdfd(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xdde(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
mov    0xe6f(%rip),%rax
mov    %rax,0xa0(%rsp)
movaps 0xe50(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xe31(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe12(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xdf6(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xdda(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe5e(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe42(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe26(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe0a(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xe3e(%rip),%rdi
call   1050 <puts@plt>
lea    0xe39(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0xfffffffa,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x13,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0xfffffffc,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xb0(%rsp),%rdi
mov    $0x11,%esi
mov    $0x5,%edx
call   1060 <print_n_min@plt>
lea    0xd70(%rip),%r14
mov    %r14,%rdi
call   1050 <puts@plt>
lea    0xd07(%rip),%rdi
call   1050 <puts@plt>
lea    0x50(%rsp),%rdi
mov    $0x16,%esi
call   1090 <place_negatives_first@plt>
mov    0x50(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x54(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x58(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x5c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x60(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x64(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x68(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x6c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x70(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x74(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x78(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x7c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x80(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x84(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x88(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x90(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x94(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x98(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x9c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0xa0(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0xa4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
lea    0xb99(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
lea    0xb7d(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%edi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x3,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x4,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x4,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x4,%edi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x940(%rip),%rdi
call   1050 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
call   10b0 <arr_min@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
mov    $0x10,%esi
call   10d0 <arr_max@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
mov    $0x10,%esi
call   10a0 <arr_avg@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x10,%esi
call   10e0 <arr_sum@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x10,%edx
call   1080 <arr_diagonal_sum@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x10,%edx
call   10c0 <arr_subdiagonal_sum@plt>
mov    %eax,(%rsp)
lea    0x8cd(%rip),%rdi
mov    %r12d,%esi
mov    %r13d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
mov    %r15d,%r9d
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x8f3(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   10f0 <swap_ext_rows@plt>
lea    0x880(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
lea    0x864(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%edi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x3,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x4,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x4,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x4,%edi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <mat_to_arr@plt>
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.a1 = [17 x i32] [i32 3, i32 4, i32 5, i32 6, i32 7, i32 -1, i32 -6, i32 19, i32 8, i32 9, i32 15, i32 -4, i32 3, i32 3, i32 10, i32 11, i32 12]
@__const.main.a2 = [22 x i32] [i32 -1, i32 1, i32 40, i32 -2, i32 3, i32 4, i32 -7, i32 4, i32 -9, i32 5, i32 6, i32 2, i32 -1, i32 -1, i32 -1, i32 1, i32 1, i32 1, i32 1, i32 -1, i32 1, i32 1]
@__const.main.m3 = [16 x i32] [i32 -4, i32 3, i32 2, i32 1, i32 5, i32 6, i32 -8, i32 -8, i32 33, i32 3, i32 3, i32 1, i32 -4, i32 -4, i32 -4, i32 -4]
@.str = [7 x i8] c"Task 1\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [7 x i8] c"Task 2\00"
@.str.5 = [8 x i8] c"Matrix:\00"
@.str.6 = [4 x i8] c"%d\09\00"
@.str.7 = [7 x i8] c"Task 3\00"
@.str.8 = [66 x i8] c"Min: %d, max: %d, avg: %lf, sum: %lld, mdsum: %lld, sdsum: %lld\0A\0A\00"
@.str.9 = [7 x i8] c"Task 4\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [17 x i32]
%3 = alloca [22 x i32]
%4 = alloca [16 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = bitcast [17 x i32]* %2 to i8*
%12 = bitcast [22 x i32]* %3 to i8*
%13 = bitcast [16 x i32]* %4 to i8*
%14 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %15
15: ; preds = %25, %0
%16 = load i32, i32* %5
%17 = zext i32 %16 to i64
%18 = icmp ult i64 %17, 17
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load i32, i32* %5
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds [17 x i32], [17 x i32]* %2, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %19
%26 = load i32, i32* %5
%27 = add i32 %26, 1
store i32 %27, i32* %5
br label %15
28: ; preds = %15
%29 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%30 = getelementptr inbounds [17 x i32], [17 x i32]* %2, i64 0, i64 0
%31 = call i32 @print_n_min(i32* %30, i32 17, i32 5)
%32 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%34 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 0
%35 = call i32 @place_negatives_first(i32* %34, i32 22)
store i32 0, i32* %6
br label %36
36: ; preds = %46, %28
%37 = load i32, i32* %6
%38 = zext i32 %37 to i64
%39 = icmp ult i64 %38, 22
br i1 %39, label %40, label %49
40: ; preds = %36
%41 = load i32, i32* %6
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %40
%47 = load i32, i32* %6
%48 = add i32 %47, 1
store i32 %48, i32* %6
br label %36
49: ; preds = %36
%50 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%51 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %7
br label %52
52: ; preds = %71, %49
%53 = load i32, i32* %7
%54 = icmp sle i32 %53, 4
br i1 %54, label %55, label %74
55: ; preds = %52
store i32 1, i32* %8
br label %56
56: ; preds = %66, %55
%57 = load i32, i32* %8
%58 = icmp sle i32 %57, 4
br i1 %58, label %59, label %69
59: ; preds = %56
%60 = load i32, i32* %7
%61 = load i32, i32* %8
%62 = call i64 @mat_to_arr(i32 %60, i32 %61, i32 4)
%63 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %64)
br label %66
66: ; preds = %59
%67 = load i32, i32* %8
%68 = add nsw i32 %67, 1
store i32 %68, i32* %8
br label %56
69: ; preds = %56
%70 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %71
71: ; preds = %69
%72 = load i32, i32* %7
%73 = add nsw i32 %72, 1
store i32 %73, i32* %7
br label %52
74: ; preds = %52
%75 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%76 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%77 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%78 = call i32 @arr_min(i32* %77, i32 16)
%79 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%80 = call i32 @arr_max(i32* %79, i32 16)
%81 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%82 = call i32 @arr_avg(i32* %81, i32 16)
%83 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%84 = call i32 @arr_sum(i32* %83, i32 16)
%85 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%86 = call i32 @arr_diagonal_sum(i32* %85, i32 4, i32 16)
%87 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%88 = call i32 @arr_subdiagonal_sum(i32* %87, i32 4, i32 16)
%89 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0), i32 %78, i32 %80, i32 %82, i32 %84, i32 %86, i32 %88)
%90 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%91 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%92 = call i32 @swap_ext_rows(i32* %91, i32 4, i32 4)
%93 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %9
br label %94
94: ; preds = %113, %74
%95 = load i32, i32* %9
%96 = icmp sle i32 %95, 4
br i1 %96, label %97, label %116
97: ; preds = %94
store i32 1, i32* %10
br label %98
98: ; preds = %108, %97
%99 = load i32, i32* %10
%100 = icmp sle i32 %99, 4
br i1 %100, label %101, label %111
101: ; preds = %98
%102 = load i32, i32* %9
%103 = load i32, i32* %10
%104 = call i64 @mat_to_arr(i32 %102, i32 %103, i32 4)
%105 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 %104
%106 = load i32, i32* %105
%107 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %106)
br label %108
108: ; preds = %101
%109 = load i32, i32* %10
%110 = add nsw i32 %109, 1
store i32 %110, i32* %10
br label %98
111: ; preds = %98
%112 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %113
113: ; preds = %111
%114 = load i32, i32* %9
%115 = add nsw i32 %114, 1
store i32 %115, i32* %9
br label %94
116: ; preds = %94
%117 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.a1 = [17 x i32] [i32 3, i32 4, i32 5, i32 6, i32 7, i32 -1, i32 -6, i32 19, i32 8, i32 9, i32 15, i32 -4, i32 3, i32 3, i32 10, i32 11, i32 12]
@__const.main.a2 = [22 x i32] [i32 -1, i32 1, i32 40, i32 -2, i32 3, i32 4, i32 -7, i32 4, i32 -9, i32 5, i32 6, i32 2, i32 -1, i32 -1, i32 -1, i32 1, i32 1, i32 1, i32 1, i32 -1, i32 1, i32 1]
@__const.main.m3 = [16 x i32] [i32 -4, i32 3, i32 2, i32 1, i32 5, i32 6, i32 -8, i32 -8, i32 33, i32 3, i32 3, i32 1, i32 -4, i32 -4, i32 -4, i32 -4]
@.str = [7 x i8] c"Task 1\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [7 x i8] c"Task 2\00"
@.str.5 = [8 x i8] c"Matrix:\00"
@.str.6 = [4 x i8] c"%d\09\00"
@.str.7 = [7 x i8] c"Task 3\00"
@.str.8 = [66 x i8] c"Min: %d, max: %d, avg: %lf, sum: %lld, mdsum: %lld, sdsum: %lld\0A\0A\00"
@.str.9 = [7 x i8] c"Task 4\00"
define i32 @main() {
%1 = alloca [17 x i32]
%2 = alloca [22 x i32]
%3 = alloca [16 x i32]
%4 = bitcast [17 x i32]* %1 to i8*
%5 = bitcast [22 x i32]* %2 to i8*
%6 = bitcast [16 x i32]* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [17 x i32], [17 x i32]* %1, i64 0, i64 0
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 6)
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 7)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -6)
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 19)
%17 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8)
%18 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 9)
%19 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 15)
%20 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -4)
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%22 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%23 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10)
%24 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 11)
%25 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 12)
%26 = tail call i32 @putchar(i32 10)
%27 = call i32 @print_n_min(i32* %8, i32 17, i32 5)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%30 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 0
%31 = call i32 @place_negatives_first(i32* %30, i32 22)
%32 = load i32, i32* %30
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 1
%35 = load i32, i32* %34
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 2
%38 = load i32, i32* %37
%39 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 3
%41 = load i32, i32* %40
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 4
%44 = load i32, i32* %43
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 5
%47 = load i32, i32* %46
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 6
%50 = load i32, i32* %49
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 7
%53 = load i32, i32* %52
%54 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 8
%56 = load i32, i32* %55
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 9
%59 = load i32, i32* %58
%60 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 10
%62 = load i32, i32* %61
%63 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 11
%65 = load i32, i32* %64
%66 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 12
%68 = load i32, i32* %67
%69 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %68)
%70 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 13
%71 = load i32, i32* %70
%72 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %71)
%73 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 14
%74 = load i32, i32* %73
%75 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %74)
%76 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 15
%77 = load i32, i32* %76
%78 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %77)
%79 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 16
%80 = load i32, i32* %79
%81 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %80)
%82 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 17
%83 = load i32, i32* %82
%84 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %83)
%85 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 18
%86 = load i32, i32* %85
%87 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %86)
%88 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 19
%89 = load i32, i32* %88
%90 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %89)
%91 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 20
%92 = load i32, i32* %91
%93 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %92)
%94 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 21
%95 = load i32, i32* %94
%96 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %95)
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%98 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%99 = call i64 @mat_to_arr(i32 1, i32 1, i32 4)
%100 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %99
%101 = load i32, i32* %100
%102 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %101)
%103 = call i64 @mat_to_arr(i32 1, i32 2, i32 4)
%104 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %103
%105 = load i32, i32* %104
%106 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %105)
%107 = call i64 @mat_to_arr(i32 1, i32 3, i32 4)
%108 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %107
%109 = load i32, i32* %108
%110 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %109)
%111 = call i64 @mat_to_arr(i32 1, i32 4, i32 4)
%112 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %111
%113 = load i32, i32* %112
%114 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %113)
%115 = call i32 @putchar(i32 10)
%116 = call i64 @mat_to_arr(i32 2, i32 1, i32 4)
%117 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %116
%118 = load i32, i32* %117
%119 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %118)
%120 = call i64 @mat_to_arr(i32 2, i32 2, i32 4)
%121 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %120
%122 = load i32, i32* %121
%123 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %122)
%124 = call i64 @mat_to_arr(i32 2, i32 3, i32 4)
%125 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %124
%126 = load i32, i32* %125
%127 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %126)
%128 = call i64 @mat_to_arr(i32 2, i32 4, i32 4)
%129 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %128
%130 = load i32, i32* %129
%131 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %130)
%132 = call i32 @putchar(i32 10)
%133 = call i64 @mat_to_arr(i32 3, i32 1, i32 4)
%134 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %133
%135 = load i32, i32* %134
%136 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %135)
%137 = call i64 @mat_to_arr(i32 3, i32 2, i32 4)
%138 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %137
%139 = load i32, i32* %138
%140 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %139)
%141 = call i64 @mat_to_arr(i32 3, i32 3, i32 4)
%142 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %141
%143 = load i32, i32* %142
%144 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %143)
%145 = call i64 @mat_to_arr(i32 3, i32 4, i32 4)
%146 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %145
%147 = load i32, i32* %146
%148 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %147)
%149 = call i32 @putchar(i32 10)
%150 = call i64 @mat_to_arr(i32 4, i32 1, i32 4)
%151 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %150
%152 = load i32, i32* %151
%153 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %152)
%154 = call i64 @mat_to_arr(i32 4, i32 2, i32 4)
%155 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %154
%156 = load i32, i32* %155
%157 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %156)
%158 = call i64 @mat_to_arr(i32 4, i32 3, i32 4)
%159 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %158
%160 = load i32, i32* %159
%161 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %160)
%162 = call i64 @mat_to_arr(i32 4, i32 4, i32 4)
%163 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %162
%164 = load i32, i32* %163
%165 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %164)
%166 = call i32 @putchar(i32 10)
%167 = call i32 @putchar(i32 10)
%168 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%169 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%170 = call i32 @arr_min(i32* %169, i32 16)
%171 = call i32 @arr_max(i32* %169, i32 16)
%172 = call i32 @arr_avg(i32* %169, i32 16)
%173 = call i32 @arr_sum(i32* %169, i32 16)
%174 = call i32 @arr_diagonal_sum(i32* %169, i32 4, i32 16)
%175 = call i32 @arr_subdiagonal_sum(i32* %169, i32 4, i32 16)
%176 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0), i32 %170, i32 %171, i32 %172, i32 %173, i32 %174, i32 %175)
%177 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%178 = call i32 @swap_ext_rows(i32* %169, i32 4, i32 4)
%179 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%180 = call i64 @mat_to_arr(i32 1, i32 1, i32 4)
%181 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %180
%182 = load i32, i32* %181
%183 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %182)
%184 = call i64 @mat_to_arr(i32 1, i32 2, i32 4)
%185 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %184
%186 = load i32, i32* %185
%187 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %186)
%188 = call i64 @mat_to_arr(i32 1, i32 3, i32 4)
%189 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %188
%190 = load i32, i32* %189
%191 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %190)
%192 = call i64 @mat_to_arr(i32 1, i32 4, i32 4)
%193 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %192
%194 = load i32, i32* %193
%195 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %194)
%196 = call i32 @putchar(i32 10)
%197 = call i64 @mat_to_arr(i32 2, i32 1, i32 4)
%198 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %197
%199 = load i32, i32* %198
%200 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %199)
%201 = call i64 @mat_to_arr(i32 2, i32 2, i32 4)
%202 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %201
%203 = load i32, i32* %202
%204 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %203)
%205 = call i64 @mat_to_arr(i32 2, i32 3, i32 4)
%206 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %205
%207 = load i32, i32* %206
%208 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %207)
%209 = call i64 @mat_to_arr(i32 2, i32 4, i32 4)
%210 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %209
%211 = load i32, i32* %210
%212 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %211)
%213 = call i32 @putchar(i32 10)
%214 = call i64 @mat_to_arr(i32 3, i32 1, i32 4)
%215 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %214
%216 = load i32, i32* %215
%217 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %216)
%218 = call i64 @mat_to_arr(i32 3, i32 2, i32 4)
%219 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %218
%220 = load i32, i32* %219
%221 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %220)
%222 = call i64 @mat_to_arr(i32 3, i32 3, i32 4)
%223 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %222
%224 = load i32, i32* %223
%225 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %224)
%226 = call i64 @mat_to_arr(i32 3, i32 4, i32 4)
%227 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %226
%228 = load i32, i32* %227
%229 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %228)
%230 = call i32 @putchar(i32 10)
%231 = call i64 @mat_to_arr(i32 4, i32 1, i32 4)
%232 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %231
%233 = load i32, i32* %232
%234 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %233)
%235 = call i64 @mat_to_arr(i32 4, i32 2, i32 4)
%236 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %235
%237 = load i32, i32* %236
%238 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %237)
%239 = call i64 @mat_to_arr(i32 4, i32 3, i32 4)
%240 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %239
%241 = load i32, i32* %240
%242 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %241)
%243 = call i64 @mat_to_arr(i32 4, i32 4, i32 4)
%244 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %243
%245 = load i32, i32* %244
%246 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %245)
%247 = call i32 @putchar(i32 10)
%248 = call i32 @putchar(i32 10)
ret i32 0
}