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

```asm
<RGB_2_YUV_AUTOTEST>:
  endbr64
  push   %r13
  lea    D35(%rip),%rdi
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <puts@plt>
  nopl   0x0(%rax)
L11:
  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    L1
  add    $0x1,%ebp
  cmp    $0xa,%ebp
  jne    L11
  lea    D45(%rip),%rdi
  call   <puts@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L1:
  lea    D40(%rip),%rdi
  call   <puts@plt>
  mov    %ebp,%esi
  lea    D3(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebx,%esi
  movzbl %bl,%ecx
  movzbl %bh,%edx
  sar    $0x10,%esi
  lea    D41(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r13d,%eax
  mov    %r13d,%esi
  movzbl %r13b,%ecx
  movzbl %ah,%edx
  sar    $0x10,%esi
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12d,%eax
  mov    %r12d,%esi
  movzbl %r12b,%ecx
  movzbl %ah,%edx
  sar    $0x10,%esi
  lea    D23(%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: D35
type_guessed: string
name: retrieve_data
arguments: data_label: D45
type_guessed: string
name: retrieve_data
arguments: data_label: D40
type_guessed: string
name: retrieve_data
arguments: data_label: D3
type_guessed: string
name: retrieve_data
arguments: data_label: D41
type_guessed: string
name: retrieve_data
arguments: data_label: D12
type_guessed: string
name: retrieve_data
arguments: data_label: D23
type_guessed: string

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

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

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

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


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


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


tool: D23:   + 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;
}
```