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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x1c(%rbp),%rax
  mov    %rax,%rsi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  movl   $0x1,-0xc(%rbp)
  jmp    L78
L11:
  lea    -0x14(%rbp),%rdx
  lea    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x18(%rbp),%eax
  cmp    $0x1,%eax
  jne    L149
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  jmp    L12
L149:
  mov    -0x14(%rbp),%eax
  cmp    $0x1,%eax
  jne    L45
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  jmp    L12
L45:
  mov    -0x18(%rbp),%eax
  cmp    $0x2,%eax
  jne    L47
  mov    -0x14(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  shl    $0x2,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  jne    L165
  addl   $0x2,-0x10(%rbp)
  jmp    L12
L165:
  mov    -0x14(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  jle    L12
  addl   $0x4,-0x10(%rbp)
  jmp    L12
L47:
  mov    -0x14(%rbp),%eax
  cmp    $0x2,%eax
  jne    L138
  mov    -0x18(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  shl    $0x2,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  jne    L37
  addl   $0x2,-0x10(%rbp)
  jmp    L12
L37:
  mov    -0x18(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  jle    L12
  addl   $0x4,-0x10(%rbp)
  jmp    L12
L138:
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  imul   %edx,%eax
  add    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x10(%rbp)
L12:
  mov    -0x10(%rbp),%edx
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  addl   $0x1,-0xc(%rbp)
L78:
  mov    -0x1c(%rbp),%eax
  cmp    %eax,-0xc(%rbp)
  jle    L11
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L6
  call   <__stack_chk_fail@plt>
L6:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D18
datatype: string
name: retrieve_data
arguments: data_tag: D2
datatype: string
name: retrieve_data
arguments: data_tag: D6
datatype: string

tool: D18: %d

tool: D2: %d %d

tool: D6: Case %d: %d


assistant: ```c
int main() {
  int t;
  int n, m;
  int res;
  int i;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    scanf("%d %d", &n, &m);
    if (n == 1) {
      res = m;
    } else if (m == 1) {
      res = n;
    } else if (n == 2) {
      res = (m / 4) * 4;
      if (m % 4 == 1)
        res += 2;
      else if (m % 4 > 1)
        res += 4;
    } else if (m == 2) {
      res = (n / 4) * 4;
      if (n % 4 == 1)
        res += 2;
      else if (n % 4 > 1)
        res += 4;
    } else {
      res = ((n * m) + 1) / 2;
    }
    printf("Case %d: %d\n", i, res);
  }
  return 0;
}
```