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

```asm
<trainDK>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x2,%esi
  mov    $0x3,%edi
  call   <useSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D102(%rip),%rdi
  call   <printf@plt>
  mov    $0x5b8d80,%edi
  call   <usleep@plt>
  mov    $0x2,%esi
  mov    $0x3,%edi
  call   <freeSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D40(%rip),%rdi
  call   <printf@plt>
  mov    $0x6,%esi
  mov    $0x2,%edi
  call   <useSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D100(%rip),%rdi
  call   <printf@plt>
  mov    $0x5b8d80,%edi
  call   <usleep@plt>
  mov    $0x6,%esi
  mov    $0x2,%edi
  call   <freeSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D21(%rip),%rdi
  call   <printf@plt>
  mov    $0x7,%esi
  mov    $0x6,%edi
  call   <useSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D3(%rip),%rdi
  call   <printf@plt>
  mov    $0x5b8d80,%edi
  call   <usleep@plt>
  mov    $0x7,%esi
  mov    $0x6,%edi
  call   <freeSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D71(%rip),%rdi
  call   <printf@plt>
  mov    $0xc,%esi
  mov    $0x7,%edi
  call   <useSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D70(%rip),%rdi
  call   <printf@plt>
  mov    $0x5b8d80,%edi
  call   <usleep@plt>
  mov    $0xc,%esi
  mov    $0x7,%edi
  call   <freeSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D20(%rip),%rdi
  call   <printf@plt>
  mov    $0x10,%esi
  mov    $0xc,%edi
  call   <useSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D63(%rip),%rdi
  call   <printf@plt>
  mov    $0x5b8d80,%edi
  call   <usleep@plt>
  mov    $0x10,%esi
  mov    $0xc,%edi
  call   <freeSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D38(%rip),%rdi
  call   <printf@plt>
  mov    $0xb,%esi
  mov    $0x10,%edi
  call   <useSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D17(%rip),%rdi
  call   <printf@plt>
  mov    $0x5b8d80,%edi
  call   <usleep@plt>
  mov    $0xb,%esi
  mov    $0x10,%edi
  call   <freeSegment@plt>
  mov    $0x0,%eax
  call   <pthread_self@plt>
  mov    %eax,%esi
  lea    D82(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D102
data_type: string
name: read_data
arguments: data_tag: D40
data_type: string
name: read_data
arguments: data_tag: D100
data_type: string
name: read_data
arguments: data_tag: D21
data_type: string
name: read_data
arguments: data_tag: D3
data_type: string
name: read_data
arguments: data_tag: D71
data_type: string
name: read_data
arguments: data_tag: D70
data_type: string
name: read_data
arguments: data_tag: D20
data_type: string
name: read_data
arguments: data_tag: D63
data_type: string
name: read_data
arguments: data_tag: D38
data_type: string
name: read_data
arguments: data_tag: D17
data_type: string
name: read_data
arguments: data_tag: D82
data_type: string

tool: D102: Train DK ID = %d occupies DC


tool: D40: Train DK ID = %d left DC


tool: D100: Train DK ID = %d occupies CF


tool: D21: Train DK ID = %d left CF


tool: D3: Train DK ID = %d occupies FG


tool: D71: Train DK ID = %d left FG


tool: D70: Train DK ID = %d occupies GL


tool: D20: Train DK ID = %d left GL


tool: D63: Train DK ID = %d occupies LP


tool: D38: Train DK ID = %d left LP


tool: D17: Train DK ID = %d occupies PK


tool: D82: Train DK ID = %d left PK [FINISHED]


assistant: ```c
void *trainDK(void *arg) {
  while (1) {
    useSegment(3, 2);
    printf("Train DK ID = %d occupies DC\n", (int)pthread_self());
    usleep(6000000);
    freeSegment(3, 2);
    printf("Train DK ID = %d left DC\n", (int)pthread_self());
    useSegment(2, 6);
    printf("Train DK ID = %d occupies CF\n", (int)pthread_self());
    usleep(6000000);
    freeSegment(2, 6);
    printf("Train DK ID = %d left CF\n", (int)pthread_self());
    useSegment(6, 7);
    printf("Train DK ID = %d occupies FG\n", (int)pthread_self());
    usleep(6000000);
    freeSegment(6, 7);
    printf("Train DK ID = %d left FG\n", (int)pthread_self());
    useSegment(7, 12);
    printf("Train DK ID = %d occupies GL\n", (int)pthread_self());
    usleep(6000000);
    freeSegment(7, 12);
    printf("Train DK ID = %d left GL\n", (int)pthread_self());
    useSegment(12, 16);
    printf("Train DK ID = %d occupies LP\n", (int)pthread_self());
    usleep(6000000);
    freeSegment(12, 16);
    printf("Train DK ID = %d left LP\n", (int)pthread_self());
    useSegment(16, 11);
    printf("Train DK ID = %d occupies PK\n", (int)pthread_self());
    usleep(6000000);
    freeSegment(16, 11);
    printf("Train DK ID = %d left PK [FINISHED]\n", (int)pthread_self());
    break;
  }
}
```