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

```asm
<generate_n_queens_serial_one>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,%r12d
  mov    %esi,-0x44(%rbp)
  mov    %edx,%r13d
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movslq %edi,%rax
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L73:
  cmp    %rdx,%rsp
  je     L167
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L73
L167:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L94
  orq    $0x0,-0x8(%rsp,%rax,1)
L94:
  lea    0x3(%rsp),%rbx
  mov    %rbx,%rsi
  shr    $0x2,%rsi
  and    $0xfffffffffffffffc,%rbx
  test   %r12d,%r12d
  jle    L110
  mov    %r12d,%edx
  mov    $0x0,%eax
L170:
  mov    %eax,(%rbx,%rax,4)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L170
L110:
  lea    0x1(%r12,%r12,4),%eax
  cltq
  add    $0xf,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L83:
  cmp    %rdx,%rsp
  je     L162
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L83
L162:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L154
  orq    $0x0,-0x8(%rsp,%rax,1)
L154:
  mov    %rsp,-0x50(%rbp)
  mov    $0x0,%r14d
  cmp    %r13d,0x0(,%rsi,4)
  je     L71
L113:
  lea    D4(%rip),%r15
L163:
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <next_permutation@plt>
  test   %rax,%rax
  jne    L29
  cmp    %r13d,(%rbx)
  jne    L163
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <check_diagonal@plt>
  cmp    $0x1,%eax
  jne    L163
  add    $0x1,%r14d
  cmpl   $0x1,-0x44(%rbp)
  jne    L163
  mov    -0x50(%rbp),%rdx
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <get_array_string@plt>
  mov    -0x50(%rbp),%rsi
  mov    %r15,%rdi
  call   <printf@plt>
  jmp    L163
L71:
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <check_diagonal@plt>
  mov    %eax,%r14d
  cmp    $0x1,%eax
  je     L67
  mov    $0x0,%r14d
  jmp    L113
L67:
  cmpl   $0x1,-0x44(%rbp)
  jne    L113
  mov    -0x50(%rbp),%r15
  mov    %r15,%rdx
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <get_array_string@plt>
  mov    %r15,%rsi
  lea    D4(%rip),%rdi
  call   <printf@plt>
  mov    -0x44(%rbp),%r14d
  jmp    L113
L29:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L141
  mov    %r14d,%eax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L141:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D4
type_guessed: string

tool: D4: %s

assistant: ```c
int generate_n_queens_serial_one(int n, int out_flag, int first) {
  int list[n];
  int p = 0;
  int solutions = 0;
  int i = 0;
  for (i = 0; i < n; i++) {
    list[i] = i;
  }
  char s[n + 4 * n + 1];
  p++;
  if (list[0] == first) {
    if (check_diagonal(list, n) == 1) {
      solutions++;
      if (out_flag == 1) {
        get_array_string(list, n, s);
        printf("%s", s);
      }
    }
  }
  while (next_permutation(list, n) == 0) {
    p++;
    if (list[0] == first) {
      if (check_diagonal(list, n) == 1) {
        solutions++;
        if (out_flag == 1) {
          get_array_string(list, n, s);
          printf("%s", s);
        }
      }
    }
  }
  return solutions;
}
```