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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0xa,-0x30(%rbp)
  movl   $0xa,-0x2c(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,%esi
  lea    D34(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x2c(%rbp),%eax
  mov    %eax,%esi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  jmp    L155
L199:
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x28(%rbp)
  cmpl   $0x3,-0x30(%rbp)
  jle    L74
  jmp    L70
L141:
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  movslq %edx,%rax
  imul   $0x2aaaaaab,%rax,%rax
  shr    $0x20,%rax
  mov    %edx,%esi
  sar    $0x1f,%esi
  mov    %eax,%ecx
  sub    %esi,%ecx
  mov    %ecx,%eax
  add    %eax,%eax
  add    %ecx,%eax
  add    %eax,%eax
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  lea    0x1(%rcx),%edx
  cltq
  mov    %edx,-0x14(%rbp,%rax,4)
L70:
  cmpl   $0x2,-0x28(%rbp)
  jle    L141
  jmp    L212
L62:
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  movslq %edx,%rax
  imul   $0x2aaaaaab,%rax,%rax
  shr    $0x20,%rax
  mov    %edx,%esi
  sar    $0x1f,%esi
  mov    %eax,%ecx
  sub    %esi,%ecx
  mov    %ecx,%eax
  add    %eax,%eax
  add    %ecx,%eax
  add    %eax,%eax
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  lea    0x1(%rcx),%edx
  cltq
  mov    %edx,-0x14(%rbp,%rax,4)
L74:
  cmpl   $0x1,-0x28(%rbp)
  jle    L62
L212:
  movl   $0x0,-0x28(%rbp)
  cmpl   $0x1,-0x2c(%rbp)
  jle    L102
  jmp    L170
L38:
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  movslq %edx,%rax
  imul   $0x2aaaaaab,%rax,%rax
  shr    $0x20,%rax
  mov    %edx,%esi
  sar    $0x1f,%esi
  mov    %eax,%ecx
  sub    %esi,%ecx
  mov    %ecx,%eax
  add    %eax,%eax
  add    %ecx,%eax
  add    %eax,%eax
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  lea    0x1(%rcx),%edx
  cltq
  mov    %edx,-0x1c(%rbp,%rax,4)
L170:
  cmpl   $0x2,-0x28(%rbp)
  jle    L38
  jmp    L194
L102:
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  movslq %edx,%rax
  imul   $0x2aaaaaab,%rax,%rax
  shr    $0x20,%rax
  mov    %edx,%esi
  sar    $0x1f,%esi
  mov    %eax,%ecx
  sub    %esi,%ecx
  mov    %ecx,%eax
  add    %eax,%eax
  add    %ecx,%eax
  add    %eax,%eax
  sub    %eax,%edx
  mov    %edx,%ecx
  lea    0x1(%rcx),%edx
  mov    -0x28(%rbp),%eax
  cltq
  mov    %edx,-0x1c(%rbp,%rax,4)
L194:
  movl   $0x2,-0x24(%rbp)
  movl   $0x3,-0x20(%rbp)
  mov    -0x20(%rbp),%edx
  lea    -0x14(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <sort@plt>
  mov    -0x24(%rbp),%edx
  lea    -0x1c(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <sort@plt>
  mov    -0x24(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jge    L81
  movl   $0x0,-0x28(%rbp)
  jmp    L80
L14:
  mov    -0x28(%rbp),%eax
  cltq
  mov    -0x14(%rbp,%rax,4),%edx
  mov    -0x28(%rbp),%eax
  cltq
  mov    -0x1c(%rbp,%rax,4),%eax
  cmp    %eax,%edx
  jle    L117
  subl   $0x1,-0x2c(%rbp)
  jmp    L165
L117:
  subl   $0x1,-0x30(%rbp)
L165:
  addl   $0x1,-0x28(%rbp)
L80:
  mov    -0x28(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L14
  jmp    L155
L81:
  movl   $0x0,-0x28(%rbp)
  jmp    L86
L234:
  mov    -0x28(%rbp),%eax
  cltq
  mov    -0x14(%rbp,%rax,4),%edx
  mov    -0x28(%rbp),%eax
  cltq
  mov    -0x1c(%rbp,%rax,4),%eax
  cmp    %eax,%edx
  jle    L142
  subl   $0x1,-0x2c(%rbp)
  jmp    L238
L142:
  subl   $0x1,-0x30(%rbp)
L238:
  addl   $0x1,-0x28(%rbp)
L86:
  mov    -0x28(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L234
L155:
  cmpl   $0x1,-0x30(%rbp)
  jle    L144
  cmpl   $0x0,-0x2c(%rbp)
  jns    L199
L144:
  cmpl   $0x0,-0x30(%rbp)
  jg     L16
  movl   $0x1,-0x30(%rbp)
L16:
  cmpl   $0x0,-0x2c(%rbp)
  jns    L198
  movl   $0x0,-0x2c(%rbp)
L198:
  mov    -0x30(%rbp),%eax
  mov    %eax,%esi
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x2c(%rbp),%eax
  mov    %eax,%esi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L13
  call   <__stack_chk_fail@plt>
L13:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D34
type: string
name: retrieve_data
arguments: data_label: D12
type: string
name: retrieve_data
arguments: data_label: D1
type: string
name: retrieve_data
arguments: data_label: D4
type: string

tool: D34: Attacker army: %i


tool: D12: Defender army: %i


tool: D1: Results:
attack: %i


tool: D4: defend: %i


assistant: ```c
int main() {
  int attacker, defender, x;
  attacker = 10;
  defender = 10;
  printf("Attacker army: %i\n", attacker);
  printf("Defender army: %i\n", defender);
  srand(time(NULL));
  while (attacker > 1 && defender >= 0) {
    int attRoll[3] = {0, 0, 0};
    int defRoll[2] = {0, 0};
    int *ap, *dp;
    x = 0;
    if (attacker > 3)
      while (x < 3)
        attRoll[x++] = (rand() % 6) + 1;
    else
      while (x < 2)
        attRoll[x++] = (rand() % 6) + 1;
    x = 0;
    if (defender > 1)
      while (x < 3)
        defRoll[x++] = (rand() % 6) + 1;
    else
      defRoll[x] = (rand() % 6) + 1;
    int defSize, attSize;
    defSize = sizeof(defRoll) / sizeof(*defRoll);
    attSize = sizeof(attRoll) / sizeof(*attRoll);
    sort(attRoll, attSize);
    sort(defRoll, defSize);
    if (defSize < attSize) {
      for (x = 0; x < defSize; x++)
        if (attRoll[x] > defRoll[x])
          defender--;
        else
          attacker--;
    } else {
      for (x = 0; x < attSize; x++)
        if (attRoll[x] > defRoll[x])
          defender--;
        else
          attacker--;
    }
  }
  if (attacker <= 0)
    attacker = 1;
  if (defender < 0)
    defender = 0;
  printf("Results:\nattack: %i\n", attacker);
  printf("defend: %i\n", defender);
  return 0;
}
```