user: 请从给定的汇编指令推导出C源代码：

```asm
<oauth2_generate_state>:
  endbr64
  push   %r13
  lea    D2(%rip),%r13
  push   %r12
  mov    $0x4,%r12d
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movb   $0x0,(%rsp)
  mov    %rsp,%rbp
L7:
  xor    %eax,%eax
  call   <random@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sar    $0x1f,%ecx
  movslq %eax,%rdi
  shr    $0x18,%ecx
  add    %rbp,%rdi
  lea    (%rbx,%rcx,1),%edx
  movzbl %dl,%edx
  sub    %ecx,%edx
  call   <sprintf@plt>
  sub    $0x1,%r12d
  jne    L7
  mov    %rbp,%rdi
  lea    D12(%rip),%r12
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    $0x2d,%edx
  movslq %eax,%rdi
  add    %rbp,%rdi
  call   <sprintf@plt>
  xor    %eax,%eax
  call   <random@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sar    $0x1f,%ecx
  movslq %eax,%rdi
  shr    $0x18,%ecx
  add    %rbp,%rdi
  lea    (%rbx,%rcx,1),%edx
  movzbl %dl,%edx
  sub    %ecx,%edx
  call   <sprintf@plt>
  xor    %eax,%eax
  call   <random@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sar    $0x1f,%ecx
  movslq %eax,%rdi
  shr    $0x18,%ecx
  add    %rbp,%rdi
  lea    (%rbx,%rcx,1),%edx
  movzbl %dl,%edx
  sub    %ecx,%edx
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    $0x2d,%edx
  movslq %eax,%rdi
  add    %rbp,%rdi
  call   <sprintf@plt>
  xor    %eax,%eax
  call   <random@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sar    $0x1f,%ecx
  movslq %eax,%rdi
  shr    $0x18,%ecx
  add    %rbp,%rdi
  lea    (%rbx,%rcx,1),%edx
  movzbl %dl,%edx
  sub    %ecx,%edx
  call   <sprintf@plt>
  xor    %eax,%eax
  call   <random@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sar    $0x1f,%ecx
  movslq %eax,%rdi
  shr    $0x18,%ecx
  add    %rbp,%rdi
  lea    (%rbx,%rcx,1),%edx
  movzbl %dl,%edx
  sub    %ecx,%edx
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    $0x2d,%edx
  movslq %eax,%rdi
  add    %rbp,%rdi
  call   <sprintf@plt>
  xor    %eax,%eax
  call   <random@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sar    $0x1f,%ecx
  movslq %eax,%rdi
  shr    $0x18,%ecx
  add    %rbp,%rdi
  lea    (%rbx,%rcx,1),%edx
  movzbl %dl,%edx
  sub    %ecx,%edx
  call   <sprintf@plt>
  xor    %eax,%eax
  call   <random@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sar    $0x1f,%ecx
  movslq %eax,%rdi
  shr    $0x18,%ecx
  add    %rbp,%rdi
  lea    (%rbx,%rcx,1),%edx
  movzbl %dl,%edx
  sub    %ecx,%edx
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    $0x2d,%edx
  mov    $0x6,%r12d
  movslq %eax,%rdi
  add    %rbp,%rdi
  call   <sprintf@plt>
  nopw   0x0(%rax,%rax,1)
L8:
  xor    %eax,%eax
  call   <random@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sar    $0x1f,%ecx
  movslq %eax,%rdi
  shr    $0x18,%ecx
  add    %rbp,%rdi
  lea    (%rbx,%rcx,1),%edx
  movzbl %dl,%edx
  sub    %ecx,%edx
  call   <sprintf@plt>
  sub    $0x1,%r12d
  jne    L8
  mov    %rbp,%rdi
  movb   $0x0,0x24(%rsp)
  call   <cpystr@plt>
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L24
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L24:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D2
type: string
name: read_data
arguments: label: D12
type: string

tool: D2: %x

tool: D12: %c

assistant: ```c
char *oauth2_generate_state(void) {
  char rv[36];
  int i;
  rv[0] = '\0';
  for (i = 0; i < 4; i++)
    sprintf(rv + strlen(rv), "%x", random() % 256);
  sprintf(rv + strlen(rv), "%c", '-');
  for (i = 0; i < 2; i++)
    sprintf(rv + strlen(rv), "%x", random() % 256);
  sprintf(rv + strlen(rv), "%c", '-');
  for (i = 0; i < 2; i++)
    sprintf(rv + strlen(rv), "%x", random() % 256);
  sprintf(rv + strlen(rv), "%c", '-');
  for (i = 0; i < 2; i++)
    sprintf(rv + strlen(rv), "%x", random() % 256);
  sprintf(rv + strlen(rv), "%c", '-');
  for (i = 0; i < 6; i++)
    sprintf(rv + strlen(rv), "%x", random() % 256);
  rv[36] = '\0';
  return cpystr(rv);
}
```