user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x7a1000(%rsp),%r11
L152:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L152
  sub    $0x258,%rsp
  lea    D41(%rip),%r12
  mov    %r12,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x7a1248(%rsp)
  xor    %eax,%eax
  lea    0x28(%rsp),%rsi
  call   <scanf@plt>
  cmpq   $0x0,0x28(%rsp)
  jle    L89
  lea    0x38(%rsp),%rax
  lea    0x40(%rsp),%r15
  movq   $0x1,0x8(%rsp)
  mov    %rax,0x18(%rsp)
  lea    0x30(%rsp),%rax
  lea    D19(%rip),%rbx
  mov    %rax,0x10(%rsp)
  nopw   0x0(%rax,%rax,1)
L97:
  mov    0x18(%rsp),%rdx
  mov    0x10(%rsp),%rsi
  xor    %eax,%eax
  xor    %r13d,%r13d
  lea    D35(%rip),%rdi
  call   <scanf@plt>
  xor    %eax,%eax
  cmpq   $0x0,0x30(%rsp)
  jle    L101
  mov    %r15,(%rsp)
  mov    %rax,%r14
  nopl   0x0(%rax)
L123:
  mov    (%rsp),%rax
  xor    %ebp,%ebp
  cmpq   $0x0,0x38(%rsp)
  lea    (%rax,%r13,8),%r15
  jle    L62
  nopw   0x0(%rax,%rax,1)
L67:
  mov    %r15,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x1,%rbp
  call   <scanf@plt>
  add    $0x8,%r15
  cmp    %rbp,0x38(%rsp)
  jg     L67
L62:
  add    $0x1,%r14
  add    $0x3e8,%r13
  cmp    %r14,0x30(%rsp)
  jg     L123
  mov    (%rsp),%r15
L101:
  lea    D27(%rip),%rdi
  call   <puts@plt>
  cmpq   $0x0,0x30(%rsp)
  jle    L19
  mov    %r15,(%rsp)
  mov    %r15,%rbp
  xor    %r14d,%r14d
  nopl   0x0(%rax)
L144:
  xor    %r13d,%r13d
  cmpq   $0x0,0x38(%rsp)
  jle    L169
  nopl   0x0(%rax,%rax,1)
L14:
  mov    0x0(%rbp,%r13,8),%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  add    $0x1,%r13
  call   <printf@plt>
  cmp    %r13,0x38(%rsp)
  jg     L14
L169:
  mov    $0xa,%edi
  add    $0x1,%r14
  add    $0x1f40,%rbp
  call   <putchar@plt>
  mov    0x30(%rsp),%rdx
  cmp    %r14,%rdx
  jg     L144
  mov    (%rsp),%r13
  test   %rdx,%rdx
  jle    L19
  xor    %ebp,%ebp
  mov    %rdx,%r14
  nopw   0x0(%rax,%rax,1)
L30:
  mov    0x38(%rsp),%rsi
  mov    %r13,%rdi
  add    $0x1,%rbp
  add    $0x1f40,%r13
  call   <sort_rows@plt>
  cmp    %rbp,%r14
  jne    L30
L19:
  mov    0x38(%rsp),%r13
  test   %r13,%r13
  jle    L181
  xor    %ebp,%ebp
  nopl   0x0(%rax)
L155:
  mov    %r13,%rsi
  mov    %r15,%rdi
  add    $0x1,%rbp
  call   <sort_cols@plt>
  cmp    %rbp,%r13
  jne    L155
L181:
  lea    D39(%rip),%rdi
  call   <puts@plt>
  cmpq   $0x0,0x30(%rsp)
  jle    L130
  mov    %r15,%rbp
  xor    %r13d,%r13d
  xchg   %ax,%ax
L121:
  xor    %r14d,%r14d
  cmpq   $0x0,0x38(%rsp)
  jle    L165
  nopl   0x0(%rax,%rax,1)
L142:
  mov    0x0(%rbp,%r14,8),%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  add    $0x1,%r14
  call   <printf@plt>
  cmp    %r14,0x38(%rsp)
  jg     L142
L165:
  mov    $0xa,%edi
  add    $0x1,%r13
  add    $0x1f40,%rbp
  call   <putchar@plt>
  cmp    %r13,0x30(%rsp)
  jg     L121
L130:
  mov    $0xa,%edi
  call   <putchar@plt>
  addq   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%rax
  cmp    %rax,0x28(%rsp)
  jge    L97
L89:
  mov    0x7a1248(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x7a1258,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D41
type: string
name: unpack_data
arguments: tag: D19
type: string
name: unpack_data
arguments: tag: D35
type: string
name: unpack_data
arguments: tag: D27
type: string
name: unpack_data
arguments: tag: D39
type: string

tool: D41: %lld

tool: D19: %lld 

tool: D35: %lld %lld

tool: D27: Original array:

tool: D39: Sorted Array:

assistant: ```c
int main() {
  long long int arr[1000][1000];
  long long int i, j, row_size, col_size;
  long long int k, x, y, z, t, n, m;
  scanf("%lld", &t);
  for (k = 1; k <= t; k++) {
    scanf("%lld %lld", &n, &m);
    for (x = 0; x < n; x++) {
      for (y = 0; y < m; y++) {
        scanf("%lld", &arr[x][y]);
      }
    }
    printf("Original array:\n");
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        printf("%lld ", arr[i][j]);
      }
      printf("\n");
    }
    row_size = n;
    for (i = 0; i < row_size; i++) {
      sort_rows(arr[i], m);
    }
    col_size = m;
    for (i = 0; i < col_size; i++) {
      sort_cols(arr, col_size);
    }
    printf("Sorted Array:\n");
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        printf("%lld ", arr[i][j]);
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}
```