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

```asm
<process_color>:
  endbr64
  push   %r15
  mov    %esi,%r15d
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %r9,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  push   %rbx
  mov    %r8,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L52
  mov    %rdi,%rbp
  call   <strlen@plt>
  test   %eax,%eax
  je     L52
  lea    D64(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L47
  mov    %rbp,%rdi
  call   <valid_rgb_color@plt>
  test   %eax,%eax
  jne    L38
  test   %r15d,%r15d
  je     L43
  lea    D14(%rip),%rcx
  mov    %r14,%rdx
  mov    %eax,0xc(%rsp)
  lea    D24(%rip),%rsi
  lea    D101(%rip),%rdi
  call   <camserv_log@plt>
  movb   $0x0,(%r12)
  mov    0xc(%rsp),%r8d
  movb   $0x0,(%rbx)
  movb   $0x0,0x0(%r13)
  jmp    L48
  nopw   0x0(%rax,%rax,1)
L52:
  test   %r15d,%r15d
  je     L93
  lea    D14(%rip),%rcx
  mov    %r14,%rdx
  lea    D2(%rip),%rsi
  lea    D101(%rip),%rdi
  call   <camserv_log@plt>
  movb   $0x0,(%r12)
  xor    %r8d,%r8d
  movb   $0x0,(%rbx)
  movb   $0x0,0x0(%r13)
L48:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L71
  add    $0x38,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L93:
  lea    D28(%rip),%rcx
  mov    %r14,%rdx
  lea    D2(%rip),%rsi
L26:
  lea    D101(%rip),%rdi
  call   <camserv_log@plt>
  movb   $0xff,(%r12)
  mov    $0xffffff,%r8d
  movb   $0xff,(%rbx)
  movb   $0xff,0x0(%r13)
  jmp    L48
  nopw   0x0(%rax,%rax,1)
L43:
  lea    D28(%rip),%rcx
  mov    %r14,%rdx
  lea    D24(%rip),%rsi
  jmp    L26
  nopl   0x0(%rax,%rax,1)
L38:
  lea    0x24(%rsp),%r8
  lea    0x20(%rsp),%rcx
  mov    %rbp,%rdi
  lea    0x1c(%rsp),%rdx
  lea    D66(%rip),%rsi
  call   <sscanf@plt>
  mov    0x1c(%rsp),%eax
  mov    %al,(%r12)
  mov    0x20(%rsp),%eax
  mov    %al,(%rbx)
  mov    0x24(%rsp),%eax
  mov    %al,0x0(%r13)
  movzbl (%rbx),%r8d
  movzbl %al,%eax
  shl    $0x8,%r8d
  or     %eax,%r8d
  movzbl (%r12),%eax
  shl    $0x10,%eax
  or     %eax,%r8d
  jmp    L48
L47:
  mov    $0xff000000,%r8d
  jmp    L48
L71:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D64
type: string
name: parse_data
arguments: tag: D14
type: string
name: parse_data
arguments: tag: D24
type: string
name: parse_data
arguments: tag: D101
type: string
name: parse_data
arguments: tag: D2
type: string
name: parse_data
arguments: tag: D28
type: string
name: parse_data
arguments: tag: D66
type: string

tool: D64: transparent

tool: D14: bg

tool: D24: Invalid [%s]:%s color given.  Format should be: #RRGGBB, or 'transparent

tool: D101: textfilter

tool: D2: Invalid [%s]:%s color given.  Using default

tool: D28: fg

tool: D66: %*c%2x%2x%2x

assistant: ```c
int process_color(const char *color, int is_bg, char *secname, unsigned char *rint, unsigned char *gint, unsigned char *bint) {
  if (!color || !strlen(color)) {
    camserv_log("textfilter",
                "Invalid [%s]:%s color given.  "
                "Using default",
                secname, is_bg ? "bg" : "fg");
    if (is_bg) {
      *rint = (0x00ff0000 & 0x00000000) >> 16;
      *gint = (0x0000ff00 & 0x00000000) >> 8;
      *bint = (0x000000ff & 0x00000000) >> 0;
      return 0x00000000;
    } else {
      *rint = (0x00ff0000 & 0x00ffffff) >> 16;
      *gint = (0x0000ff00 & 0x00ffffff) >> 8;
      *bint = (0x000000ff & 0x00ffffff) >> 0;
      return 0x00ffffff;
    }
  }
  if (!strcmp(color, "transparent"))
    return 0xff000000;
  else {
    int rf, gf, bf;
    if (!valid_rgb_color(color)) {
      camserv_log("textfilter",
                  "Invalid [%s]:%s color given.  "
                  "Format should be: #RRGGBB, or 'transparent",
                  secname, is_bg ? "bg" : "fg");
      if (is_bg) {
        *rint = (0x00ff0000 & 0x00000000) >> 16;
        *gint = (0x0000ff00 & 0x00000000) >> 8;
        *bint = (0x000000ff & 0x00000000) >> 0;
        return 0x00000000;
      } else {
        *rint = (0x00ff0000 & 0x00ffffff) >> 16;
        *gint = (0x0000ff00 & 0x00ffffff) >> 8;
        *bint = (0x000000ff & 0x00ffffff) >> 0;
        return 0x00ffffff;
      }
    }
    sscanf(color, "%*c%2x%2x%2x", &rf, &gf, &bf);
    *rint = rf;
    *gint = gf;
    *bint = bf;
    return (*rint << 16) | (*gint << 8) | *bint;
  }
}
```