user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x14(%rbp)
  movl   $0x1,-0x10(%rbp)
  lea    -0x24(%rbp),%rax
  mov    %rax,%rsi
  lea    D85(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x24(%rbp),%eax
  test   %eax,%eax
  jle    L29
  mov    -0x24(%rbp),%eax
  cmp    $0x64,%eax
  jle    L157
L29:
  lea    D82(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L69
L78:
  lea    -0x18(%rbp),%rcx
  lea    -0x1c(%rbp),%rdx
  lea    -0x20(%rbp),%rax
  mov    %rax,%rsi
  lea    D47(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x20(%rbp),%eax
  test   %eax,%eax
  je     L82
  mov    -0x20(%rbp),%eax
  cmp    $0x3e8,%eax
  jbe    L76
L82:
  lea    D45(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L157
L76:
  mov    -0x1c(%rbp),%eax
  test   %eax,%eax
  je     L12
  mov    -0x1c(%rbp),%eax
  cmp    $0x3e8,%eax
  jbe    L9
L12:
  lea    D57(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L157
L9:
  mov    -0x18(%rbp),%eax
  test   %eax,%eax
  je     L146
  mov    -0x18(%rbp),%eax
  cmp    $0x3e8,%eax
  jbe    L66
L146:
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L157
L66:
  mov    -0x18(%rbp),%edx
  mov    -0x1c(%rbp),%ecx
  mov    -0x20(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <solve@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,%esi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  cmpl   $0x0,-0xc(%rbp)
  jns    L91
  lea    D63(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L157
L91:
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L157:
  mov    -0x14(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x14(%rbp)
  mov    -0x24(%rbp),%edx
  cmp    %edx,%eax
  jl     L78
  movl   $0x0,-0x10(%rbp)
L69:
  mov    -0x10(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L75
  call   <__stack_chk_fail@plt>
L75:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D85
data_type: string
name: retrieve_data
arguments: data_label: D82
data_type: string
name: retrieve_data
arguments: data_label: D47
data_type: string
name: retrieve_data
arguments: data_label: D45
data_type: string
name: retrieve_data
arguments: data_label: D57
data_type: string
name: retrieve_data
arguments: data_label: D28
data_type: string
name: retrieve_data
arguments: data_label: D87
data_type: string
name: retrieve_data
arguments: data_label: D63
data_type: string
name: retrieve_data
arguments: data_label: D5
data_type: string

tool: D85: %d

tool: D82: Illegal number of tests (1 <= T <= 100)

tool: D47: %d %d %d

tool: D45: 1 <= a <= 1000

tool: D57: 1 <= b <= 1000

tool: D28: 1 <= k <= 1000

tool: D87: Case #%d: 

tool: D63: ERROR

tool: D5: %d


assistant: ```c
int main(int argc, char **argv) {
  int num_tests, test = 0, ret = 1;
  int round;
  unsigned int a, b, k;
  scanf("%d", &num_tests);
  if (num_tests < 1 || num_tests > 100) {
    printf("Illegal number of tests (1 <= T <= 100)\n");
    goto out;
  }
  while (test++ < num_tests) {
    scanf("%d %d %d", &a, &b, &k);
    if (a < 1 || a > 1000) {
      printf("1 <= a <= 1000\n");
      continue;
    }
    if (b < 1 || b > 1000) {
      printf("1 <= b <= 1000\n");
      continue;
    }
    if (k < 1 || k > 1000) {
      printf("1 <= k <= 1000\n");
      continue;
    }
    round = solve(a, b, k);
    printf("Case #%d: ", test);
    if (round < 0)
      printf("ERROR\n");
    else
      printf("%d\n", round);
  }
  ret = 0;
out:
  return ret;
}
```