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

```asm
<gui_nicklist_add_to_infolist>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L118
  mov    %rsi,%rbp
  test   %rsi,%rsi
  je     L118
  mov    %rdi,%r12
  mov    %rdx,%rbx
  test   %rdx,%rdx
  je     L112
  mov    $0x5,%edx
  lea    D6(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L65
  mov    $0x6,%edx
  lea    D13(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L102
L112:
  lea    0x10(%rsp),%r13
  lea    0x8(%rsp),%rbx
  mov    %rbp,%rdi
  movq   $0x0,0x8(%rsp)
  movq   $0x0,0x10(%rsp)
  mov    %r13,%rdx
  mov    %rbx,%rsi
  call   <gui_nicklist_get_next_item@plt>
  jmp    L87
  nopl   0x0(%rax)
L121:
  test   %rsi,%rsi
  je     L27
L48:
  mov    %r12,%rdi
  call   <gui_nicklist_add_nick_to_infolist@plt>
L120:
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <gui_nicklist_get_next_item@plt>
L87:
  mov    0x8(%rsp),%r8
  mov    0x10(%rsp),%rsi
  test   %r8,%r8
  jne    L121
  test   %rsi,%rsi
  jne    L48
  mov    $0x1,%eax
L15:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L139
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L27:
  mov    %r8,%rsi
  mov    %r12,%rdi
  call   <gui_nicklist_add_group_to_infolist@plt>
  jmp    L120
  nopl   (%rax)
L118:
  xor    %eax,%eax
  jmp    L15
L102:
  xor    %esi,%esi
  lea    0x6(%rbx),%rdx
  mov    %rbp,%rdi
  call   <gui_nicklist_search_group@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%rsi
  test   %rax,%rax
  je     L118
  mov    %r12,%rdi
  call   <gui_nicklist_add_group_to_infolist@plt>
  jmp    L15
L65:
  xor    %esi,%esi
  lea    0x5(%rbx),%rdx
  mov    %rbp,%rdi
  call   <gui_nicklist_search_nick@plt>
  mov    %rax,0x10(%rsp)
  mov    %rax,%rsi
  test   %rax,%rax
  je     L118
  mov    %r12,%rdi
  call   <gui_nicklist_add_nick_to_infolist@plt>
  jmp    L15
L139:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D6
type_guessed: string
name: parse_data
arguments: label: D13
type_guessed: string

tool: D6: nick_

tool: D13: group_

assistant: ```c
int gui_nicklist_add_to_infolist(struct t_infolist *infolist, struct t_gui_buffer *buffer, const char *name) {
  struct t_gui_nick_group *ptr_group;
  struct t_gui_nick *ptr_nick;
  if (!infolist || !buffer)
    return 0;
  if (name && (strncmp(name, "nick_", 5) == 0)) {
    ptr_nick = gui_nicklist_search_nick(buffer, NULL, name + 5);
    if (!ptr_nick)
      return 0;
    return gui_nicklist_add_nick_to_infolist(infolist, ptr_nick);
  }
  if (name && (strncmp(name, "group_", 6) == 0)) {
    ptr_group = gui_nicklist_search_group(buffer, NULL, name + 6);
    if (!ptr_group)
      return 0;
    return gui_nicklist_add_group_to_infolist(infolist, ptr_group);
  }
  ptr_group = NULL;
  ptr_nick = NULL;
  gui_nicklist_get_next_item(buffer, &ptr_group, &ptr_nick);
  while (ptr_group || ptr_nick) {
    if (ptr_nick)
      gui_nicklist_add_nick_to_infolist(infolist, ptr_nick);
    else
      gui_nicklist_add_group_to_infolist(infolist, ptr_group);
    gui_nicklist_get_next_item(buffer, &ptr_group, &ptr_nick);
  }
  return 1;
}
```