user: Please show me the C implementation that matches the assembly code listed below:

```asm
<reorganize_GPU_to_upper_triangle>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x44(%rbp)
  mov    %esi,-0x48(%rbp)
  mov    %edx,-0x4c(%rbp)
  mov    %ecx,-0x50(%rbp)
  mov    %r8,-0x58(%rbp)
  mov    %r9,-0x60(%rbp)
  movl   $0x0,-0x34(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L37
L53:
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  mov    -0x50(%rbp),%eax
  cltd
  idivl  -0x44(%rbp)
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x50(%rbp),%eax
  add    $0x1,%eax
  imul   -0x50(%rbp),%eax
  imul   -0x30(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x10(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L31
L28:
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jne    L92
  subl   $0x1,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  add    %eax,-0x20(%rbp)
  addl   $0x1,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x2c(%rbp)
L92:
  movl   $0x0,-0x18(%rbp)
  jmp    L107
L30:
  movl   $0x0,-0x14(%rbp)
  jmp    L121
L21:
  mov    -0x2c(%rbp),%eax
  imul   -0x44(%rbp),%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x28(%rbp),%eax
  imul   -0x44(%rbp),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  imul   -0x50(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  add    %eax,%edx
  mov    -0x8(%rbp),%eax
  sub    $0x1,%eax
  imul   -0x8(%rbp),%eax
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  add    %ecx,%eax
  sar    %eax
  neg    %eax
  add    %eax,%edx
  mov    -0xc(%rbp),%eax
  sub    -0x8(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x2c(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  je     L81
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x34(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x60(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x34(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  add    $0x1,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x60(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  jmp    L5
L81:
  mov    -0x14(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L19
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x34(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x60(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x34(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  add    $0x1,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x60(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  jmp    L5
L19:
  addl   $0x2,-0x34(%rbp)
L5:
  addl   $0x1,-0x14(%rbp)
L121:
  mov    -0x14(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L21
  addl   $0x1,-0x18(%rbp)
L107:
  mov    -0x18(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L30
  addl   $0x1,-0x2c(%rbp)
  addl   $0x1,-0x1c(%rbp)
L31:
  mov    -0x1c(%rbp),%eax
  cmp    -0x48(%rbp),%eax
  jl     L28
  addl   $0x1,-0x30(%rbp)
L37:
  mov    -0x30(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L53
  nop
  pop    %rbp
  ret
```

assistant: ```c
void reorganize_GPU_to_upper_triangle(int block_side_length, int num_blocks, int actual_num_frequencies, int actual_num_elements, int *gpu_data, int *final_matrix) {
  int GPU_address = 0;
  for (int frequency_bin = 0; frequency_bin < actual_num_frequencies; frequency_bin++) {
    int block_x_ID = 0;
    int block_y_ID = 0;
    int num_blocks_x = actual_num_elements / block_side_length;
    int block_check = num_blocks_x;
    int frequency_offset = frequency_bin * (actual_num_elements * (actual_num_elements + 1)) / 2;
    for (int block_ID = 0; block_ID < num_blocks; block_ID++) {
      if (block_ID == block_check) {
        num_blocks_x--;
        block_check += num_blocks_x;
        block_y_ID++;
        block_x_ID = block_y_ID;
      }
      for (int y_ID_local = 0; y_ID_local < block_side_length; y_ID_local++) {
        for (int x_ID_local = 0; x_ID_local < block_side_length; x_ID_local++) {
          int x_ID_global = block_x_ID * block_side_length + x_ID_local;
          int y_ID_global = block_y_ID * block_side_length + y_ID_local;
          int address_1d_output = frequency_offset + y_ID_global * actual_num_elements - ((y_ID_global - 1) * y_ID_global) / 2 + (x_ID_global - y_ID_global);
          if (block_x_ID != block_y_ID) {
            final_matrix[address_1d_output * 2] = gpu_data[GPU_address++];
            final_matrix[address_1d_output * 2 + 1] = gpu_data[GPU_address++];
          } else {
            if (x_ID_local >= y_ID_local) {
              final_matrix[address_1d_output * 2] = gpu_data[GPU_address++];
              final_matrix[address_1d_output * 2 + 1] = gpu_data[GPU_address++];
            } else {
              GPU_address += 2;
            }
          }
        }
      }
      block_x_ID++;
    }
  }
  return;
}
```