user: 请将以下的汇编代码转换成C语言代码：

```asm
<atomic>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x1,-0x18(%rbp)
  movb   $0x1,-0x1a(%rbp)
  movb   $0x0,-0x19(%rbp)
  movl   $0x1,-0x14(%rbp)
  movl   $0x0,-0xc(%rbp)
  mov    $0x1,%eax
  lock xadd %eax,-0x18(%rbp)
  mov    %eax,-0x10(%rbp)
  mov    $0x2,%eax
  neg    %eax
  lock xadd %al,-0x1a(%rbp)
  movsbl %al,%eax
  mov    %eax,-0x10(%rbp)
  lea    -0x18(%rbp),%rax
  mov    $0x3,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <__sync_fetch_and_min@plt>
  mov    %eax,-0x10(%rbp)
  lea    -0x18(%rbp),%rax
  mov    $0x4,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <__sync_fetch_and_max@plt>
  mov    %eax,-0x10(%rbp)
  lea    -0x14(%rbp),%rax
  mov    $0x5,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <__sync_fetch_and_umin@plt>
  mov    %eax,-0x10(%rbp)
  lea    -0x14(%rbp),%rax
  mov    $0x6,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <__sync_fetch_and_umax@plt>
  mov    %eax,-0x10(%rbp)
  mov    $0x7,%eax
  xchg   %eax,-0x18(%rbp)
  mov    %eax,-0x10(%rbp)
  mov    $0x4,%eax
  mov    $0x7b8,%edx
  lock cmpxchg %edx,-0x18(%rbp)
  mov    %eax,-0x10(%rbp)
  mov    $0x4,%eax
  mov    $0x7b8,%edx
  lock cmpxchg %edx,-0x18(%rbp)
  sete   %al
  movzbl %al,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
L3:
  mov    %eax,%ecx
  mov    %eax,%edx
  and    $0x9,%edx
  lock cmpxchg %edx,-0x18(%rbp)
  sete   %dl
  test   %dl,%dl
  je     L3
  mov    %ecx,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
L16:
  mov    %eax,%ecx
  mov    %eax,%edx
  or     $0xa,%edx
  lock cmpxchg %edx,-0x18(%rbp)
  sete   %dl
  test   %dl,%dl
  je     L16
  mov    %ecx,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
L0:
  mov    %eax,%ecx
  mov    %eax,%edx
  xor    $0xb,%edx
  lock cmpxchg %edx,-0x18(%rbp)
  sete   %dl
  test   %dl,%dl
  je     L0
  mov    %ecx,-0x10(%rbp)
  mov    $0x1,%eax
  lock xadd %eax,-0x18(%rbp)
  add    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  mov    $0x2,%eax
  neg    %eax
  mov    %eax,%edx
  mov    %edx,%eax
  lock xadd %eax,-0x18(%rbp)
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  movzbl -0x1a(%rbp),%eax
L20:
  mov    %eax,%edx
  and    $0x3,%edx
  mov    %edx,%ecx
  lock cmpxchg %dl,-0x1a(%rbp)
  sete   %dl
  test   %dl,%dl
  je     L20
  mov    %ecx,%eax
  movsbl %al,%eax
  mov    %eax,-0x10(%rbp)
  movzbl -0x1a(%rbp),%eax
L51:
  mov    %eax,%edx
  or     $0x4,%edx
  mov    %edx,%ecx
  lock cmpxchg %dl,-0x1a(%rbp)
  sete   %dl
  test   %dl,%dl
  je     L51
  mov    %ecx,%eax
  movsbl %al,%eax
  mov    %eax,-0x10(%rbp)
  movzbl -0x1a(%rbp),%eax
L49:
  mov    %eax,%edx
  xor    $0x5,%edx
  mov    %edx,%ecx
  lock cmpxchg %dl,-0x1a(%rbp)
  sete   %dl
  test   %dl,%dl
  je     L49
  mov    %ecx,%eax
  movsbl %al,%eax
  mov    %eax,-0x10(%rbp)
  mov    $0x0,%eax
  lock cmpxchg %rax,0x0
  mov    $0x0,%eax
  mov    $0x1,%edx
  lock cmpxchg %dl,-0x19(%rbp)
  test   %al,%al
  je     L7
  movl   $0x2a,-0x10(%rbp)
L7:
  mov    $0x0,%eax
  lock cmpxchg %rax,0x0
  mov    $0x0,%eax
  mov    %eax,-0x18(%rbp)
  lock orq $0x0,(%rsp)
  mov    -0x10(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L66
  call   <__stack_chk_fail@plt>
L66:
  leave
  ret
```

assistant: ```c
int atomic(void) {
  int old;
  int val = 1;
  char valc = 1;
  _Bool valb = 0;
  unsigned int uval = 1;
  int cmp = 0;
  old = __sync_fetch_and_add(&val, 1);
  old = __sync_fetch_and_sub(&valc, 2);
  old = __sync_fetch_and_min(&val, 3);
  old = __sync_fetch_and_max(&val, 4);
  old = __sync_fetch_and_umin(&uval, 5u);
  old = __sync_fetch_and_umax(&uval, 6u);
  old = __sync_lock_test_and_set(&val, 7);
  old = __sync_val_compare_and_swap(&val, 4, 1976);
  old = __sync_bool_compare_and_swap(&val, 4, 1976);
  old = __sync_fetch_and_and(&val, 0x9);
  old = __sync_fetch_and_or(&val, 0xa);
  old = __sync_fetch_and_xor(&val, 0xb);
  old = __sync_add_and_fetch(&val, 1);
  old = __sync_sub_and_fetch(&val, 2);
  old = __sync_and_and_fetch(&valc, 3);
  old = __sync_or_and_fetch(&valc, 4);
  old = __sync_xor_and_fetch(&valc, 5);
  __sync_val_compare_and_swap((void **)0, (void *)0, (void *)0);
  if (__sync_val_compare_and_swap(&valb, 0, 1)) {
    old = 42;
  }
  __sync_bool_compare_and_swap((void **)0, (void *)0, (void *)0);
  __sync_lock_release(&val);
  __sync_synchronize();
  return old;
}
```