user: What would the C source look like for the assembly code provided here:

```asm
<ts_sdt_add_service_descriptor>:
  endbr64
  mov    %r8,%rax
  or     %rcx,%rax
  je     L121
  push   %r15
  mov    %edx,%r15d
  push   %r14
  mov    %esi,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %r8,%rbx
  sub    $0x18,%rsp
  test   %rcx,%rcx
  je     L125
  mov    %rcx,%rdi
  call   <strlen@plt>
  lea    0x4(%rax),%r12d
  mov    $0x1,%eax
  test   %rbx,%rbx
  je     L127
L94:
  mov    %rbx,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
L127:
  lea    (%r12,%rax,1),%esi
  cmp    $0x101,%esi
  jg     L101
  mov    $0x1,%edi
  mov    %esi,0xc(%rsp)
  call   <calloc@plt>
  mov    0xc(%rsp),%ecx
  cmp    $0x1,%r15b
  movb   $0x48,(%rax)
  mov    %rax,%r12
  lea    -0x2(%rcx),%eax
  mov    %al,0x1(%r12)
  mov    $0x1,%eax
  adc    $0x0,%al
  mov    %al,0x2(%r12)
  test   %rbp,%rbp
  je     L66
  mov    %rbp,%rdi
  mov    $0x5,%r15d
  call   <strlen@plt>
  mov    0xc(%rsp),%ecx
  mov    %al,0x3(%r12)
  movzbl 0x0(%rbp),%edx
  test   %dl,%dl
  jne    L111
L14:
  test   %rbx,%rbx
  je     L102
  cmpb   $0x0,(%rbx)
  je     L102
  mov    %rbx,%rdi
  mov    %ecx,0xc(%rsp)
  call   <strlen@plt>
  mov    0xc(%rsp),%ecx
  mov    %rax,%r8
  lea    0x1(%r15),%eax
  mov    %r8b,(%r12,%r15,1)
  movzbl (%rbx),%edx
  test   %dl,%dl
  je     L102
  cltq
  sub    %r15,%rbx
  nopl   0x0(%rax)
L148:
  mov    %dl,(%r12,%rax,1)
  add    $0x1,%rax
  movzbl -0x1(%rbx,%rax,1),%edx
  test   %dl,%dl
  jne    L148
L102:
  add    $0x18,%rsp
  mov    %r12,%rdx
  mov    %r14d,%esi
  mov    %r13,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10a0 <ts_sdt_add_stream@plt>
  nopl   (%rax)
L101:
  lea    D9(%rip),%rdi
  call   <ts_LOGf@plt>
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L125:
  mov    $0x4,%r12d
  test   %r8,%r8
  jne    L94
  mov    $0x5,%esi
  mov    $0x1,%edi
  call   <calloc@plt>
  mov    %rax,%r12
  mov    $0x348,%eax
  mov    %ax,(%r12)
  test   %r15b,%r15b
  je     L134
  movb   $0x1,0x2(%r12)
  mov    $0x5,%ecx
L66:
  movb   $0x0,0x3(%r12)
  mov    $0x5,%r15d
  jmp    L14
  nopl   0x0(%rax)
L111:
  mov    $0x5,%eax
  nopl   (%rax)
L119:
  mov    %dl,-0x1(%r12,%rax,1)
  movslq %eax,%r15
  add    $0x1,%rax
  movzbl -0x5(%rbp,%rax,1),%edx
  test   %dl,%dl
  jne    L119
  jmp    L14
  nopw   0x0(%rax,%rax,1)
L121:
  xor    %eax,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L134:
  movb   $0x2,0x2(%r12)
  mov    $0x5,%ecx
  jmp    L66
```

tool_calls: name: disassemble_data
arguments: tag: D9
data_type: string

tool: D9: SDT service_descriptor size > 255 is not supported (%d)!


assistant: ```c
int ts_sdt_add_service_descriptor(struct ts_sdt *sdt, uint16_t service_id, uint8_t video, char *provider_name, char *service_name) {
  char *name;
  if (!service_name && !provider_name)
    return 0;
  int desc_size = 2 + 1;
  desc_size += 1 + (provider_name ? strlen(provider_name) : 0);
  desc_size += 1 + (service_name ? strlen(service_name) : 0);
  if (desc_size > 257) {
    ts_LOGf("SDT service_descriptor size > 255 is not supported (%d)!\n", desc_size);
    return 0;
  }
  int dpos = 0;
  uint8_t *desc = calloc(1, desc_size);
  desc[dpos + 0] = 0x48;
  desc[dpos + 1] = desc_size - 2;
  desc[dpos + 2] = video ? 0x01 : 0x02;
  desc[dpos + 3] = (provider_name ? strlen(provider_name) : 0);
  dpos += 4;
  if (!provider_name || strlen(provider_name) == 0) {
    dpos++;
  } else {
    name = provider_name;
    while (name[0]) {
      desc[dpos++] = name[0];
      name++;
    }
  }
  if (!service_name || strlen(service_name) == 0) {
    dpos++;
  } else {
    desc[dpos++] = (service_name ? strlen(service_name) : 0);
    name = service_name;
    while (name[0]) {
      desc[dpos++] = name[0];
      name++;
    }
  }
  return ts_sdt_add_stream(sdt, service_id, desc, desc_size);
}
```