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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,%rbx
  cmp    $0x2,%edi
  jle    L85
  mov    %edi,%ebp
  mov    0x8(%rsi),%r14
  mov    0x10(%rsi),%rdi
  call   <atoi@plt>
  mov    %eax,0x4(%rsp)
  cmp    $0x4,%ebp
  je     L50
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L11
  mov    $0x1,%r13d
L78:
  mov    0x8(%rsp),%r12
  mov    %r12,%rbx
  mov    $0x0,%ebp
  lea    D58(%rip),%r15
L96:
  mov    0x4(%rsp),%esi
  mov    %r14,%rdi
  call   <x_create_tcp_client@plt>
  mov    %eax,%esi
  mov    %eax,(%r12)
  cmp    $0xffffffff,%eax
  je     L128
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%ebp
  add    $0x4,%r12
  cmp    %r13d,%ebp
  jl     L96
  jmp    L104
L85:
  mov    (%rsi),%rsi
  lea    D33(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L76
L50:
  mov    0x18(%rbx),%rdi
  call   <atoi@plt>
  mov    %eax,%r13d
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L11
  test   %r13d,%r13d
  jg     L78
  mov    $0x1,%esi
  lea    D51(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <pause@plt>
  jmp    L34
L11:
  lea    D49(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L76
L128:
  lea    D9(%rip),%rdi
  call   <perror@plt>
L104:
  lea    0x1(%rbp),%esi
  lea    D51(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <pause@plt>
  test   %ebp,%ebp
  jle    L34
  lea    -0x1(%rbp),%eax
  lea    0x4(%rbx,%rax,4),%rbp
L115:
  mov    (%rbx),%edi
  call   <x_close@plt>
  add    $0x4,%rbx
  cmp    %rbx,%rbp
  jne    L115
L34:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    $0x0,%eax
L76:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: label: D58
type: string
name: unpack_data
arguments: label: D33
type: string
name: unpack_data
arguments: label: D51
type: string
name: unpack_data
arguments: label: D49
type: string
name: unpack_data
arguments: label: D9
type: string

tool: D58: create client fd: %d


tool: D33: usage: %s <ip> <port> [connections]


tool: D51: create %d connect


tool: D49: malloc failed

tool: D9: create tcp client error

assistant: ```c
int main(int argc, char *argv[]) {
  int connections = 1;
  char *ip = NULL;
  int port = -1;
  int *conns = NULL;
  int i = 0;
  int j = 0;
  if (argc < 3) {
    printf("usage: %s <ip> <port> [connections]\n", argv[0]);
    return -1;
  }
  ip = argv[1];
  port = atoi(argv[2]);
  if (argc == 4) {
    connections = atoi(argv[3]);
  }
  conns = (int *)malloc(sizeof(int) * connections);
  if (conns == NULL) {
    printf("malloc failed");
    return -1;
  }
  for (i = 0; i < connections; i++) {
    conns[i] = x_create_tcp_client(ip, port);
    if (conns[i] == -1) {
      perror("create tcp client error");
      break;
    }
    printf("create client fd: %d\n", conns[i]);
  }
  printf("create %d connect\n", i + 1);
  pause();
  for (j = 0; j < i; j++) {
    x_close(conns[j]);
  }
  free(conns);
  return 0;
}
```