user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<gemoffer>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  xor    %r15d,%r15d
  push   %r14
  push   %r13
  push   %r12
  mov    $0xffffffff,%r12d
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    0x100(%rsp),%rax
  mov    %rdi,0x18(%rsp)
  lea    0x6c(%rsp),%rbx
  mov    %rsi,0x20(%rsp)
  mov    %rax,0x40(%rsp)
  mov    0x108(%rsp),%rax
  mov    %rdx,0x28(%rsp)
  mov    %rax,0x8(%rsp)
  mov    0x110(%rsp),%rax
  mov    %r8,0x30(%rsp)
  mov    %rax,0x48(%rsp)
  mov    0x118(%rsp),%rax
  mov    %r9,0x38(%rsp)
  mov    %rax,0x50(%rsp)
  mov    0x120(%rsp),%rax
  mov    %rax,0x10(%rsp)
  mov    0x128(%rsp),%rax
  mov    %rax,0x58(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  movl   $0xa,0x6c(%rsp)
  movq   $0x0,0x90(%rsp)
  movaps %xmm0,0x70(%rsp)
  movaps %xmm0,0x80(%rsp)
  jmp    L239
  nopw   0x0(%rax,%rax,1)
L35:
  lea    -0xe(%rax),%edx
  cmp    $0x8,%edx
  ja     L118
  movslq %eax,%rdx
  mov    %eax,%ecx
  add    $0x1,%r12d
  imul   $0x4ec4ec4f,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x22,%rdx
  sub    %ecx,%edx
  lea    (%rdx,%rdx,2),%ecx
  lea    (%rdx,%rcx,4),%ecx
  mov    %eax,%edx
  sub    %ecx,%edx
  add    %edx,%r15d
  movslq %r12d,%rdx
  mov    %eax,0x70(%rsp,%rdx,4)
L63:
  mov    0x10(%rsp),%r14
  mov    0x8(%rsp),%r13
  movslq (%r14),%rax
  mov    0x0(%r13,%rax,4),%edi
  call   <valueitem@plt>
  cmp    %r15d,%eax
  jle    L141
  movslq (%r14),%rax
  mov    0x0(%r13,%rax,4),%edi
  call   <valueitem@plt>
  mov    %r15d,%edx
  lea    D96(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
L76:
  mov    0x10(%rsp),%rax
  mov    0x8(%rsp),%rcx
  movslq (%rax),%rax
  mov    (%rcx,%rax,4),%edi
  call   <valueitem@plt>
  cmp    %r15d,%eax
  jle    L45
L239:
  lea    D66(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <getint@plt>
  movslq 0x6c(%rsp),%rax
  cmp    $0x9,%eax
  ja     L206
  mov    0x0(%rbp,%rax,4),%eax
  test   %eax,%eax
  jne    L35
L206:
  lea    D21(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <getint@plt>
  cmpl   $0x1,0x6c(%rsp)
  jne    L63
  nopl   0x0(%rax)
L45:
  mov    0xb8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L209
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L141:
  mov    %r15d,%esi
  lea    D53(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D16(%rip),%r14
  xor    %eax,%eax
  movl   $0x0,0x6c(%rsp)
  lea    0xa0(%rsp),%r13
  cmp    $0xffffffff,%r12d
  jne    L111
  jmp    L241
  nopw   0x0(%rax,%rax,1)
L16:
  lea    D106(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x6c(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x6c(%rsp)
  cmp    %r12d,%eax
  jg     L241
L111:
  cltq
  mov    %r13,%rdi
  mov    0x70(%rsp,%rax,4),%esi
  call   <nameitem@plt>
  mov    %r13,%rsi
  cmp    %r12d,0x6c(%rsp)
  jne    L16
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x6c(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x6c(%rsp)
  cmp    %r12d,%eax
  jle    L111
L241:
  movslq %r12d,%rax
  movl   $0xffffffff,0x6c(%rsp)
  lea    D18(%rip),%r14
  lea    0x74(%rsp,%rax,4),%r13
  jmp    L119
  nopl   0x0(%rax)
L247:
  cmp    $0x1,%eax
  je     L194
L36:
  test   %eax,%eax
  jns    L76
L119:
  mov    %r14,%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <getint@plt>
  mov    0x6c(%rsp),%eax
  test   %eax,%eax
  jne    L247
  lea    D31(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <getint@plt>
  cmpl   $0x1,0x6c(%rsp)
  je     L207
  lea    D43(%rip),%rdi
  call   <puts@plt>
  mov    0x6c(%rsp),%eax
  test   %eax,%eax
  je     L207
  pxor   %xmm0,%xmm0
  movl   $0xa,0x6c(%rsp)
  mov    $0xffffffff,%r12d
  movq   $0x0,0x90(%rsp)
  movaps %xmm0,0x70(%rsp)
  movaps %xmm0,0x80(%rsp)
  jmp    L76
  nopl   0x0(%rax,%rax,1)
L194:
  movl   $0x0,0x6c(%rsp)
  cmp    $0xffffffff,%r12d
  je     L6
  lea    0x70(%rsp),%rax
  nopl   0x0(%rax,%rax,1)
L90:
  movslq (%rax),%rdx
  add    $0x4,%rax
  movl   $0x0,0x0(%rbp,%rdx,4)
  cmp    %r13,%rax
  jne    L90
  lea    0x1(%r12),%eax
  mov    %eax,0x6c(%rsp)
L6:
  sub    $0x8,%rsp
  mov    %rbp,%rcx
  push   $0x0
  push   $0x1
  push   $0x0
  push   0x78(%rsp)
  push   0x38(%rsp)
  push   0x80(%rsp)
  push   0x80(%rsp)
  push   0x48(%rsp)
  push   0x88(%rsp)
  mov    0x88(%rsp),%r9
  mov    0x80(%rsp),%r8
  mov    0x78(%rsp),%rdx
  mov    0x70(%rsp),%rsi
  mov    0x68(%rsp),%rdi
  call   <treasure@plt>
  mov    0xbc(%rsp),%eax
  add    $0x50,%rsp
  jmp    L36
  nopw   0x0(%rax,%rax,1)
L118:
  lea    D56(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <getint@plt>
  cmpl   $0x1,0x6c(%rsp)
  jne    L63
L207:
  lea    D59(%rip),%rdi
  call   <puts@plt>
  jmp    L45
L209:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D96
datatype: string
name: read_data
arguments: data_tag: D66
datatype: string
name: read_data
arguments: data_tag: D21
datatype: string
name: read_data
arguments: data_tag: D53
datatype: string
name: read_data
arguments: data_tag: D16
datatype: string
name: read_data
arguments: data_tag: D106
datatype: string
name: read_data
arguments: data_tag: D18
datatype: string
name: read_data
arguments: data_tag: D31
datatype: string
name: read_data
arguments: data_tag: D43
datatype: string
name: read_data
arguments: data_tag: D56
datatype: string
name: read_data
arguments: data_tag: D59
datatype: string

tool: D96: 'My item is valued %d gems and you offer is worth %d gems.'


tool: D66: 'What gem do you want to offer?'

tool: D21: 'Are you kidding me? Do you want to abort the trade?'
[0]: No
[1]: Yes

tool: D53: 'I'm satisfied with your offer of %d gems:

tool: D16:  %s gems.'


tool: D106:  %s gems,

tool: D18: 'Do you accept the trade?'
[0]: No
[1]: Yes

tool: D31: 'Do you want to abort the trade?'
[0]: No
[1]: Yes

tool: D43: 'Do you want to propose another offer?'
[0]: No
[1]: Yes

tool: D56: 'That's not a gem! Do you want to abort the trade?'
[0]: No
[1]: Yes

tool: D59: You aborted the trade.

assistant: ```c
void gemoffer(int *hpmax, int *hpnow, int *aces, int *inv, int *slave, int *future, int *map, int *loot, int *vision, int *end, int *pos, int *antimag) {
  int value = 0;
  int k;
  int offgem[10];
  for (k = 0; k < 10; k++) {
    offgem[k] = 0;
  }
  char s[20];
  int p = -1;
  do {
    printf("'What gem do you want to offer?'\n");
    getint(&k);
    if ((k < 0) || (k >= 10) || (*(inv + k) == 0)) {
      printf("'Are you kidding me? Do you want to abort the trade?'\n[0]: No\n[1]: Yes\n");
      getint(&k);
      if (k == 1)
        return;
    } else if ((*(inv + k) > 22) || (*(inv + k) < 14)) {
      printf("'That's not a gem! Do you want to abort the trade?'\n[0]: No\n[1]: Yes\n");
      getint(&k);
      if (k == 1) {
        printf("You aborted the trade.\n");
        return;
      }
    } else {
      value += *(inv + k) % 13;
      p++;
      offgem[p] = *(inv + k);
    }
    if (value < valueitem(*(loot + *pos)))
      printf("'My item is valued %d gems and you offer is worth %d gems.'\n", valueitem(*(loot + *pos)), value);
    else {
      printf("'I'm satisfied with your offer of %d gems:", value);
      for (k = 0; k <= p; k++) {
        nameitem(s, offgem[k]);
        if (k == p) {
          printf(" %s gems.'\n", s);
        } else {
          printf(" %s gems,", s);
        }
      }
      k = -1;
      do {
        printf("'Do you accept the trade?'\n[0]: No\n[1]: Yes\n");
        getint(&k);
        if (k == 0) {
          printf("'Do you want to abort the trade?'\n[0]: No\n[1]: Yes\n");
          getint(&k);
          if (k == 1) {
            printf("You aborted the trade.\n");
            return;
          }
          printf("'Do you want to propose another offer?'\n[0]: No\n[1]: Yes\n");
          if (k == 0) {
            printf("You aborted the trade.\n");
            return;
          }
          for (k = 0; k < 10; k++) {
            offgem[k] = 0;
          }
          p = -1;
        } else if (k == 1) {
          for (k = 0; k <= p; k++) {
            *(inv + offgem[k]) = 0;
          }
          treasure(hpmax, hpnow, aces, inv, slave, future, map, loot, vision, end, pos, antimag, 0, 1, 0);
        }
      } while (k < 0);
    }
  } while (value < valueitem(*(loot + *pos)));
}
```