user: Please show me the C implementation that matches the assembly code listed below:

```asm
<generate_n_queens_serial_one>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,-0x74(%rbp)
  mov    %esi,-0x78(%rbp)
  mov    %edx,-0x7c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0x74(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x58(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L108:
  cmp    %rdx,%rsp
  je     L19
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L108
L19:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L169
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L169:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x50(%rbp)
  movl   $0x0,-0x64(%rbp)
  movl   $0x0,-0x60(%rbp)
  movl   $0x0,-0x5c(%rbp)
  movl   $0x0,-0x5c(%rbp)
  jmp    L115
L126:
  mov    -0x50(%rbp),%rax
  mov    -0x5c(%rbp),%edx
  movslq %edx,%rdx
  mov    -0x5c(%rbp),%ecx
  mov    %ecx,(%rax,%rdx,4)
  addl   $0x1,-0x5c(%rbp)
L115:
  mov    -0x5c(%rbp),%eax
  cmp    -0x74(%rbp),%eax
  jl     L126
  mov    -0x74(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    $0x1,%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  movslq %eax,%rdx
  mov    %rdx,%r8
  mov    $0x0,%r9d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L48:
  cmp    %rdx,%rsp
  je     L14
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L48
L14:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L113
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L113:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x40(%rbp)
  addl   $0x1,-0x64(%rbp)
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x7c(%rbp)
  jne    L132
  mov    -0x74(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <check_diagonal@plt>
  cmp    $0x1,%eax
  jne    L132
  addl   $0x1,-0x60(%rbp)
  cmpl   $0x1,-0x78(%rbp)
  jne    L132
  mov    -0x40(%rbp),%rdx
  mov    -0x74(%rbp),%ecx
  mov    -0x50(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <get_array_string@plt>
  mov    -0x40(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L132
L148:
  addl   $0x1,-0x64(%rbp)
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x7c(%rbp)
  jne    L132
  mov    -0x74(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <check_diagonal@plt>
  cmp    $0x1,%eax
  jne    L132
  addl   $0x1,-0x60(%rbp)
  cmpl   $0x1,-0x78(%rbp)
  jne    L132
  mov    -0x40(%rbp),%rdx
  mov    -0x74(%rbp),%ecx
  mov    -0x50(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <get_array_string@plt>
  mov    -0x40(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L132:
  mov    -0x74(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <next_permutation@plt>
  test   %rax,%rax
  je     L148
  mov    -0x60(%rbp),%eax
  mov    %rbx,%rsp
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L92
  call   <__stack_chk_fail@plt>
L92:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D13
datatype: string

tool: D13: %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;
}
```