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

```asm
<test1>:
  endbr64
  push   %r15
  lea    D41(%rip),%rsi
  xor    %edi,%edi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1000,%edi
  xor    %eax,%eax
  call   <shm_create@plt>
  mov    $0x1000,%edi
  mov    %eax,%ebp
  xor    %eax,%eax
  call   <shm_create@plt>
  mov    $0x1000,%edi
  mov    %eax,%r12d
  xor    %eax,%eax
  call   <shm_create@plt>
  mov    $0x1000,%edi
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <shm_create@plt>
  mov    %eax,%r14d
  mov    %ebp,%eax
  or     %r12d,%eax
  or     %r13d,%eax
  or     %r14d,%eax
  jns    L114
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0x38,%rsp
  lea    D4(%rip),%rsi
  mov    $0x1,%edi
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10b0 <printf@plt>
  nopl   (%rax)
L114:
  lea    0x8(%rsp),%r15
  xor    %eax,%eax
  mov    %ebp,%edi
  mov    %r15,%rsi
  call   <shm_get@plt>
  test   %eax,%eax
  js     L164
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  mov    %r12d,%edi
  call   <shm_get@plt>
  test   %eax,%eax
  js     L164
  lea    0x18(%rsp),%rbx
  xor    %eax,%eax
  mov    %r13d,%edi
  mov    %rbx,%rsi
  call   <shm_get@plt>
  test   %eax,%eax
  js     L164
  mov    %ebp,%edi
  xor    %eax,%eax
  call   <shm_close@plt>
  lea    0x20(%rsp),%rsi
  mov    %r14d,%edi
  xor    %eax,%eax
  call   <shm_get@plt>
  mov    0x20(%rsp),%rax
  mov    0x10(%rsp),%rdx
  cmp    %rdx,%rax
  jae    L12
  mov    0x18(%rsp),%rcx
  cmp    %rcx,%rax
  jae    L12
  cmp    %rcx,%rdx
  jae    L12
  mov    $0x1000,%edi
  xor    %eax,%eax
  call   <shm_create@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  js     L197
  mov    %eax,%edi
  mov    %r15,%rsi
  xor    %eax,%eax
  call   <shm_get@plt>
  test   %eax,%eax
  js     L164
  mov    0x10(%rsp),%rax
  cmp    %rax,0x20(%rsp)
  jae    L12
  mov    0x18(%rsp),%rdx
  cmp    %rdx,%rax
  jae    L12
  cmp    0x8(%rsp),%rdx
  jae    L12
  mov    %r12d,%edi
  xor    %eax,%eax
  call   <shm_close@plt>
  mov    %r13d,%edi
  xor    %eax,%eax
  call   <shm_close@plt>
  mov    $0x1000,%edi
  xor    %eax,%eax
  call   <shm_create@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  js     L197
  mov    %eax,%edi
  mov    %rbx,%rsi
  xor    %eax,%eax
  call   <shm_get@plt>
  test   %eax,%eax
  js     L164
  mov    0x18(%rsp),%rax
  cmp    %rax,0x20(%rsp)
  jae    L12
  cmp    0x8(%rsp),%rax
  jae    L12
  mov    %ebp,%edi
  xor    %eax,%eax
  call   <shm_close@plt>
  mov    %r12d,%edi
  xor    %eax,%eax
  call   <shm_close@plt>
  mov    %r14d,%edi
  xor    %eax,%eax
  call   <shm_close@plt>
  lea    D48(%rip),%rsi
  xor    %edi,%edi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L118
  nopl   0x0(%rax)
L164:
  lea    D0(%rip),%rsi
  xor    %edi,%edi
  xor    %eax,%eax
  call   <printf@plt>
L118:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L12:
  lea    D37(%rip),%rsi
  mov    $0x1,%edi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L118
  nopl   (%rax)
L197:
  lea    D8(%rip),%rsi
  mov    $0x1,%edi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L118
L43:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D41
type_infered: string
name: read_data
arguments: tag: D4
type_infered: string
name: read_data
arguments: tag: D48
type_infered: string
name: read_data
arguments: tag: D0
type_infered: string
name: read_data
arguments: tag: D37
type_infered: string
name: read_data
arguments: tag: D8
type_infered: string

tool: D41: Executing test1


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


tool: D48: End Executing test1


tool: D0: error getting block


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


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


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");
}
```