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

```asm
<test1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D3(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1000,%edi
  mov    $0x0,%eax
  call   <shm_create@plt>
  mov    %eax,-0x38(%rbp)
  mov    $0x1000,%edi
  mov    $0x0,%eax
  call   <shm_create@plt>
  mov    %eax,-0x34(%rbp)
  mov    $0x1000,%edi
  mov    $0x0,%eax
  call   <shm_create@plt>
  mov    %eax,-0x30(%rbp)
  mov    $0x1000,%edi
  mov    $0x0,%eax
  call   <shm_create@plt>
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x0,-0x38(%rbp)
  js     L308
  cmpl   $0x0,-0x34(%rbp)
  js     L308
  cmpl   $0x0,-0x30(%rbp)
  js     L308
  cmpl   $0x0,-0x2c(%rbp)
  jns    L105
L308:
  lea    D68(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L105:
  lea    -0x28(%rbp),%rdx
  mov    -0x38(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_get@plt>
  test   %eax,%eax
  jns    L311
  lea    D2(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L311:
  lea    -0x20(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_get@plt>
  test   %eax,%eax
  jns    L304
  lea    D2(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L304:
  lea    -0x18(%rbp),%rdx
  mov    -0x30(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_get@plt>
  test   %eax,%eax
  jns    L261
  lea    D2(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L261:
  mov    -0x38(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_close@plt>
  lea    -0x10(%rbp),%rdx
  mov    -0x2c(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_get@plt>
  mov    -0x10(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  cmp    %rax,%rdx
  jae    L153
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  cmp    %rax,%rdx
  jb     L135
L153:
  lea    D73(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L135:
  mov    -0x10(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  cmp    %rax,%rdx
  jae    L278
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  cmp    %rax,%rdx
  jb     L310
L278:
  lea    D73(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L310:
  mov    $0x1000,%edi
  mov    $0x0,%eax
  call   <shm_create@plt>
  mov    %eax,-0x38(%rbp)
  cmpl   $0x0,-0x38(%rbp)
  jns    L88
  lea    D35(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L88:
  lea    -0x28(%rbp),%rdx
  mov    -0x38(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_get@plt>
  test   %eax,%eax
  jns    L23
  lea    D2(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L23:
  mov    -0x10(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  cmp    %rax,%rdx
  jae    L313
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  cmp    %rax,%rdx
  jae    L313
  mov    -0x18(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  cmp    %rax,%rdx
  jb     L121
L313:
  lea    D73(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L121:
  mov    -0x34(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_close@plt>
  mov    -0x30(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_close@plt>
  mov    $0x1000,%edi
  mov    $0x0,%eax
  call   <shm_create@plt>
  mov    %eax,-0x30(%rbp)
  cmpl   $0x0,-0x30(%rbp)
  jns    L80
  lea    D35(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L80:
  lea    -0x18(%rbp),%rdx
  mov    -0x30(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_get@plt>
  test   %eax,%eax
  jns    L97
  lea    D2(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L97:
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  cmp    %rax,%rdx
  jae    L206
  mov    -0x18(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  cmp    %rax,%rdx
  jb     L320
L206:
  lea    D73(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L320:
  mov    -0x38(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_close@plt>
  mov    -0x30(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_close@plt>
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <shm_close@plt>
  lea    D57(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <printf@plt>
L328:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L138
  call   <__stack_chk_fail@plt>
L138:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D3
data_type: string
name: parse_data
arguments: data_label: D68
data_type: string
name: parse_data
arguments: data_label: D2
data_type: string
name: parse_data
arguments: data_label: D73
data_type: string
name: parse_data
arguments: data_label: D35
data_type: string
name: parse_data
arguments: data_label: D57
data_type: string

tool: D3: Executing test1


tool: D68: ****Error creating shared memory blocks*****


tool: D2: error getting block


tool: D73: ****Error when in alloc orden*****


tool: D35: ****Error recreating shared memory blocks*****


tool: D57: End Executing test1


assistant: ```c
void test1() {
  int block1, block2, block3, block4;
  void *addr1;
  void *addr2;
  void *addr3;
  void *addr4;
  printf(0, "Executing test1\n");
  block1 = shm_create(4096);
  block2 = shm_create(4096);
  block3 = shm_create(4096);
  block4 = shm_create(4096);
  if (block1 < 0 || block2 < 0 || block3 < 0 || block4 < 0) {
    printf(1, "****Error creating shared memory blocks*****\n");
    return;
  }
  if (shm_get(block1, &addr1) < 0) {
    printf(0, "error getting block\n");
    return;
  }
  if (shm_get(block2, &addr2) < 0) {
    printf(0, "error getting block\n");
    return;
  }
  if (shm_get(block3, &addr3) < 0) {
    printf(0, "error getting block\n");
    return;
  }
  shm_close(block1);
  shm_get(block4, &addr4);
  if (addr4 >= addr2 || addr4 >= addr3) {
    printf(1, "****Error when in alloc orden*****\n");
    return;
  }
  if (!(addr4 < addr2 && addr2 < addr3)) {
    printf(1, "****Error when in alloc orden*****\n");
    return;
  }
  if ((block1 = shm_create(4096)) < 0) {
    printf(1, "****Error recreating shared memory blocks*****\n");
    return;
  }
  if (shm_get(block1, &addr1) < 0) {
    printf(0, "error getting block\n");
    return;
  }
  if (!(addr4 < addr2 && addr2 < addr3 && addr3 < addr1)) {
    printf(1, "****Error when in alloc orden*****\n");
    return;
  }
  shm_close(block2);
  shm_close(block3);
  if ((block3 = shm_create(4096)) < 0) {
    printf(1, "****Error recreating shared memory blocks*****\n");
    return;
  }
  if (shm_get(block3, &addr3) < 0) {
    printf(0, "error getting block\n");
    return;
  }
  if (!(addr4 < addr3 && addr3 < addr1)) {
    printf(1, "****Error when in alloc orden*****\n");
    return;
  }
  shm_close(block1);
  shm_close(block3);
  shm_close(block4);
  printf(0, "End Executing test1\n");
}
```