user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x10(%rbp)
  lea    -0x40(%rbp),%rax
  mov    %rax,%rsi
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  movl   $0x0,-0x3c(%rbp)
  jmp    L0
L64:
  lea    -0x38(%rbp),%rdx
  lea    -0x30(%rbp),%rax
  mov    %rax,%rsi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  lea    -0x18(%rbp),%rcx
  lea    -0x20(%rbp),%rdx
  lea    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%rax
  cmp    %rax,%rdx
  jl     L87
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  cmp    %rax,%rdx
  jl     L87
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rcx
  imul   %rax,%rcx
  mov    -0x38(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  imul   %rdx,%rax
  add    %rcx,%rax
  mov    %rax,-0x10(%rbp)
L87:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%rax
  cmp    %rax,%rdx
  jl     L19
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  cmp    %rax,%rdx
  jge    L19
  mov    -0x38(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rcx
  imul   %rax,%rcx
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%rax
  imul   %rdx,%rax
  add    %rcx,%rax
  mov    %rax,-0x10(%rbp)
L19:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%rax
  cmp    %rax,%rdx
  jge    L12
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  cmp    %rax,%rdx
  jl     L12
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rcx
  imul   %rax,%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x38(%rbp),%rax
  imul   %rdx,%rax
  add    %rcx,%rax
  mov    %rax,-0x10(%rbp)
L12:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  movq   $0x0,-0x10(%rbp)
  addl   $0x1,-0x3c(%rbp)
L0:
  mov    -0x40(%rbp),%eax
  cmp    %eax,-0x3c(%rbp)
  jl     L64
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L3
  call   <__stack_chk_fail@plt>
L3:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D30
datatype: string
name: disassemble_data
arguments: data_label: D20
datatype: string
name: disassemble_data
arguments: data_label: D13
datatype: string
name: disassemble_data
arguments: data_label: D8
datatype: string

tool: D30: %d

tool: D20: %ld %ld

tool: D13: %ld %ld %ld

tool: D8: %ld


assistant: ```c
int main() {
  int t, i, j, k;
  long int w, b, x, y, z, cost = 0;
  scanf("%d", &t);
  for (i = 0; i < t; i++) {
    scanf("%ld %ld", &b, &w);
    scanf("%ld %ld %ld", &x, &y, &z);
    if (y <= (x + z) && x <= (y + z))
      cost = b * x + w * y;
    if (y <= (x + z) && x > (y + z))
      cost = w * y + b * (y + z);
    if (y > (x + z) && x <= (y + z))
      cost = b * x + w * (x + z);
    printf("%ld\n", cost);
    cost = 0;
  }
  return 0;
}
```