user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<player_build>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %edi,%r12d
  mov    %edx,%edi
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  movslq %esi,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  call   <data_gethand@plt>
  mov    (%rsp,%rbx,4),%r14d
  xor    %eax,%eax
  call   <data_getera@plt>
  mov    %ebp,%edi
  mov    %r14d,%edx
  mov    %eax,%esi
  call   <data_canafford@plt>
  mov    %eax,%r14d
  xor    %eax,%eax
  call   <data_numplayers@plt>
  cmp    %r12d,%eax
  je     L145
L179:
  xor    %r12d,%r12d
L153:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L143
  add    $0x38,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L145:
  cmpl   $0xffffffff,(%rsp,%rbx,4)
  je     L179
  mov    %r13d,%esi
  mov    $0x3d,%edi
  call   <postoptions@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  je     L166
  cmp    $0x1,%eax
  je     L130
  cmp    $0x2,%eax
  jne    L179
  mov    %ebp,%edi
  call   <data_getnextwonderstage@plt>
  cmp    $0xffffffff,%eax
  je     L25
  mov    %ebp,%edi
  call   <data_getnextwonderstage@plt>
  mov    %ebp,%edi
  mov    %eax,%r12d
  call   <data_getwonder@plt>
  mov    %r12d,%edx
  mov    %ebp,%edi
  mov    %eax,%esi
  call   <data_canafford@plt>
  test   %eax,%eax
  je     L127
  mov    (%rsp,%rbx,4),%esi
  mov    %ebp,%edi
  mov    $0x1,%r12d
  call   <data_buildwonder@plt>
  jmp    L153
  xchg   %ax,%ax
L166:
  mov    (%rsp,%rbx,4),%r15d
  xor    %eax,%eax
  call   <data_getera@plt>
  mov    %ebp,%edi
  mov    %eax,%esi
  mov    %r15d,%edx
  call   <data_hasbuiltname@plt>
  test   %rax,%rax
  jne    L40
  cmp    $0x1,%r14d
  je     L66
  cmp    $0x2,%r14d
  je     L79
L127:
  lea    D19(%rip),%rdi
  xor    %r12d,%r12d
  call   <postmessage@plt>
  jmp    L153
L79:
  lea    D21(%rip),%rdx
  mov    %r13d,%esi
  mov    $0x3d,%edi
  call   <postyn@plt>
  test   %rax,%rax
  je     L127
  mov    (%rsp,%rbx,4),%esi
  mov    %ebp,%edi
  mov    $0x1,%r12d
  call   <data_build@plt>
  xor    %eax,%eax
  call   <data_spendfreebuild@plt>
  jmp    L153
  nopl   (%rax)
L130:
  mov    (%rsp,%rbx,4),%esi
  mov    %ebp,%edi
  call   <data_discard@plt>
  mov    %ebp,%esi
  mov    $0x3,%edi
  call   <data_addgold@plt>
  jmp    L153
  nopl   0x0(%rax,%rax,1)
L40:
  lea    D33(%rip),%rdi
  call   <postmessage@plt>
  jmp    L153
L25:
  lea    D23(%rip),%rdi
  call   <postmessage@plt>
  jmp    L179
L66:
  mov    (%rsp,%rbx,4),%esi
  mov    %ebp,%edi
  mov    $0x1,%r12d
  call   <data_build@plt>
  jmp    L153
L143:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D19
type_guessed: string
name: extract_symbolic_data
arguments: label: D21
type_guessed: string
name: extract_symbolic_data
arguments: label: D33
type_guessed: string
name: extract_symbolic_data
arguments: label: D23
type_guessed: string

tool: D19: Can't afford this!

tool: D21: Spend free build?

tool: D33: Cannot have two of the same card!

tool: D23: Wonder already complete.

assistant: ```c
int player_build(int focus, int cursor, int player, int y) {
  int hand[7];
  data_gethand(player, hand);
  int afford = data_canafford(player, data_getera(), hand[cursor]);
  if (focus == data_numplayers()) {
    if (hand[cursor] == -1)
      return 0;
    int choice = postoptions(61, y);
    if (choice == 0) {
      if (data_hasbuiltname(player, data_getera(), hand[cursor])) {
        postmessage("Cannot have two of the same card!");
        return 0;
      }
      if (afford == 1 || (afford == 2 && postyn(61, y, "Spend free build?"))) {
        data_build(player, hand[cursor]);
        if (afford == 2)
          data_spendfreebuild();
        return 1;
      } else
        postmessage("Can't afford this!");
    } else if (choice == 1) {
      data_discard(player, hand[cursor]);
      data_addgold(3, player);
      return 1;
    } else if (choice == 2) {
      if (data_getnextwonderstage(player) == -1) {
        postmessage("Wonder already complete.");
      } else if (data_canafford(player, data_getwonder(player), data_getnextwonderstage(player))) {
        data_buildwonder(player, hand[cursor]);
        return 1;
      } else
        postmessage("Can't afford this!");
    }
  }
  return 0;
}
```