user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<reorganize_GPU_to_upper_triangle>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,-0x50(%rsp)
  mov    %esi,-0x2c(%rsp)
  mov    %edx,-0x8(%rsp)
  test   %edx,%edx
  jle    L21
  mov    %ecx,%eax
  lea    (%rdi,%rdi,1),%ebx
  mov    %ecx,-0x4c(%rsp)
  mov    %r8,%r15
  cltd
  mov    %ebx,-0x44(%rsp)
  mov    %r9,%r14
  idiv   %edi
  movl   $0x0,-0x10(%rsp)
  movl   $0x0,-0x14(%rsp)
  movl   $0x0,-0x34(%rsp)
  mov    %eax,-0x4(%rsp)
  mov    %ecx,%eax
  add    $0x1,%eax
  mov    %eax,%esi
  movslq %ebx,%rax
  imul   %ecx,%esi
  shl    $0x2,%rax
  mov    %rax,-0x40(%rsp)
  lea    -0x1(%rdi),%eax
  mov    %esi,-0xc(%rsp)
  lea    (%rax,%rax,1),%esi
  imul   %edi,%eax
  mov    %esi,-0x20(%rsp)
  add    %eax,%eax
  mov    %eax,-0x28(%rsp)
  lea    0x1(%rbx),%eax
  mov    %eax,-0x18(%rsp)
L17:
  mov    -0x10(%rsp),%ebx
  mov    %ebx,%eax
  shr    $0x1f,%eax
  add    %ebx,%eax
  sar    %eax
  mov    %eax,-0x1c(%rsp)
  mov    -0x2c(%rsp),%eax
  test   %eax,%eax
  jle    L83
  mov    -0x4(%rsp),%eax
  movl   $0x0,-0x38(%rsp)
  xor    %r12d,%r12d
  xor    %r13d,%r13d
  mov    %eax,-0x30(%rsp)
  mov    %eax,-0x24(%rsp)
  nop
L32:
  mov    -0x38(%rsp),%ebx
  cmp    %ebx,-0x30(%rsp)
  jne    L52
  subl   $0x1,-0x24(%rsp)
  mov    -0x24(%rsp),%eax
  lea    0x1(%r12),%r13d
  add    %eax,-0x30(%rsp)
  mov    %r13d,%r12d
L52:
  mov    -0x50(%rsp),%eax
  test   %eax,%eax
  jle    L31
  mov    %eax,%ebx
  imul   %r12d,%eax
  mov    -0x18(%rsp),%r9d
  xor    %r10d,%r10d
  imul   %r13d,%ebx
  mov    %eax,%r11d
  mov    -0x4c(%rsp),%eax
  mov    %ebx,-0x48(%rsp)
  imul   %r11d,%eax
  add    -0x1c(%rsp),%eax
  mov    %eax,-0x54(%rsp)
  movslq -0x34(%rsp),%rax
  mov    %rax,%rbx
  add    %eax,%r9d
  lea    (%r15,%rax,4),%rbp
  nopl   0x0(%rax,%rax,1)
L99:
  lea    -0x1(%r11),%edx
  mov    %rbp,%rcx
  xor    %esi,%esi
  imul   %r11d,%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  mov    -0x54(%rsp),%edx
  sar    %eax
  sub    %eax,%edx
  mov    -0x48(%rsp),%eax
  sub    %r11d,%eax
  add    %eax,%edx
  lea    0x1(%rbx),%eax
  add    %edx,%edx
  jmp    L86
  nopl   0x0(%rax)
L109:
  mov    (%rcx),%r8d
  movslq %edx,%rdi
  mov    %r8d,(%r14,%rdi,4)
  movslq %eax,%r8
  mov    (%r15,%r8,4),%r8d
  mov    %r8d,0x4(%r14,%rdi,4)
L102:
  add    $0x2,%eax
  add    $0x1,%esi
  add    $0x2,%edx
  add    $0x8,%rcx
  cmp    %r9d,%eax
  je     L56
L86:
  cmp    %r12d,%r13d
  jne    L109
  cmp    %esi,%r10d
  jg     L102
  jmp    L109
  nopl   0x0(%rax)
L56:
  mov    -0x44(%rsp),%ecx
  mov    -0x4c(%rsp),%edi
  add    $0x1,%r10d
  add    $0x1,%r11d
  add    %edi,-0x54(%rsp)
  add    -0x40(%rsp),%rbp
  add    %ecx,%ebx
  lea    (%rax,%rcx,1),%r9d
  cmp    %r10d,-0x50(%rsp)
  jne    L99
  mov    -0x34(%rsp),%ebx
  mov    -0x20(%rsp),%eax
  lea    0x2(%rax,%rbx,1),%eax
  add    -0x28(%rsp),%eax
  mov    %eax,-0x34(%rsp)
L31:
  addl   $0x1,-0x38(%rsp)
  add    $0x1,%r13d
  mov    -0x38(%rsp),%eax
  cmp    %eax,-0x2c(%rsp)
  jne    L32
L83:
  addl   $0x1,-0x14(%rsp)
  mov    -0xc(%rsp),%esi
  mov    -0x14(%rsp),%eax
  add    %esi,-0x10(%rsp)
  cmp    %eax,-0x8(%rsp)
  jne    L17
L21:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  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;
}
```