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

```asm
<RGB_2_YUV_AUTOTEST>:
  endbr64
  push   %r13
  lea    D24(%rip),%rdi
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <puts@plt>
  nopl   0x0(%rax)
L17:
  xor    %eax,%eax
  call   <rand@plt>
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <rand@plt>
  mov    %ebx,%edx
  sar    $0x1f,%edx
  shr    $0x18,%edx
  add    %edx,%ebx
  movzbl %bl,%ebx
  sub    %edx,%ebx
  cltd
  shr    $0x18,%edx
  shl    $0x10,%ebx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  shl    $0x8,%eax
  or     %eax,%ebx
  xor    %eax,%eax
  call   <rand@plt>
  cltd
  shr    $0x18,%edx
  lea    (%rax,%rdx,1),%esi
  movzbl %sil,%esi
  sub    %edx,%esi
  or     %esi,%ebx
  mov    %ebx,%edi
  call   <instr_rgb2yuv@plt>
  mov    %ebx,%edi
  mov    %eax,%r13d
  call   <prog_rgb2yuv@plt>
  mov    %eax,%r12d
  cmp    %eax,%r13d
  jne    L2
  add    $0x1,%ebp
  cmp    $0xa,%ebp
  jne    L17
  lea    D61(%rip),%rdi
  call   <puts@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L2:
  lea    D5(%rip),%rdi
  call   <puts@plt>
  mov    %ebp,%esi
  lea    D1(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebx,%esi
  movzbl %bl,%ecx
  movzbl %bh,%edx
  sar    $0x10,%esi
  lea    D8(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r13d,%eax
  mov    %r13d,%esi
  movzbl %r13b,%ecx
  movzbl %ah,%edx
  sar    $0x10,%esi
  lea    D67(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12d,%eax
  mov    %r12d,%esi
  movzbl %r12b,%ecx
  movzbl %ah,%edx
  sar    $0x10,%esi
  lea    D45(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D24
type_guessed: string
name: retrieve_data
arguments: data_label: D61
type_guessed: string
name: retrieve_data
arguments: data_label: D5
type_guessed: string
name: retrieve_data
arguments: data_label: D1
type_guessed: string
name: retrieve_data
arguments: data_label: D8
type_guessed: string
name: retrieve_data
arguments: data_label: D67
type_guessed: string
name: retrieve_data
arguments: data_label: D45
type_guessed: string

tool: D24: LAUNCHING THE (RGB_2_YUV) RESOURCE TEST...

tool: D61: - TEST OF THE (RGB_2_YUV) RESOURCE => OK

tool: D5: - TEST OF THE (RGB_2_YUV) RESOURCE => FAILED !

tool: D1:   + %d COMPUTATION BEFORE ERROR... !


tool: D8:   + INPUT DATA         = (%d, %d, %d)


tool: D67:   + INSTRUCTION RESULT = (%d, %d, %d)


tool: D45:   + C CODE RESULT      = (%d, %d, %d)


assistant: ```c
int RGB_2_YUV_AUTOTEST() {
  int i, j;
  printf("LAUNCHING THE (RGB_2_YUV) RESOURCE TEST...\n");
  for (j = 0; j < 10; j++) {
    int op1 = ((rand() % 256) << 16) | ((rand() % 256) << 8) | (rand() % 256);
    int res1 = instr_rgb2yuv(op1);
    int res2 = prog_rgb2yuv(op1);
    if (res1 != res2) {
      printf("- TEST OF THE (RGB_2_YUV) RESOURCE => FAILED !\n");
      printf("  + %d COMPUTATION BEFORE ERROR... !\n", j);
      printf("  + INPUT DATA         = (%d, %d, %d)\n", (op1 >> 16), ((op1 >> 8) & 0xFF), (op1 & 0xFF));
      printf("  + INSTRUCTION RESULT = (%d, %d, %d)\n", (res1 >> 16), ((res1 >> 8) & 0xFF), (res1 & 0xFF));
      printf("  + C CODE RESULT      = (%d, %d, %d)\n", (res2 >> 16), ((res2 >> 8) & 0xFF), (res2 & 0xFF));
      return 0;
    }
  }
  printf("- TEST OF THE (RGB_2_YUV) RESOURCE => OK\n");
  return 1;
}
```