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

```asm
<invalid_work_group_size>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %esi,-0x48(%rbp)
  mov    %edx,-0x4c(%rbp)
  mov    %rcx,-0x58(%rbp)
  mov    %r8,-0x60(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D0(%rip),%rax
  mov    (%rax),%esi
  lea    -0x38(%rbp),%rdx
  mov    -0x44(%rbp),%eax
  mov    $0x0,%r8d
  mov    %rdx,%rcx
  mov    $0x8,%edx
  mov    %eax,%edi
  call   <clGetDeviceInfo@plt>
  mov    D2(%rip),%rax
  mov    (%rax),%esi
  lea    -0x20(%rbp),%rdx
  mov    -0x44(%rbp),%eax
  mov    $0x0,%r8d
  mov    %rdx,%rcx
  mov    $0x18,%edx
  mov    %eax,%edi
  call   <clGetDeviceInfo@plt>
  mov    D14(%rip),%rax
  mov    (%rax),%edx
  lea    -0x30(%rbp),%rcx
  mov    -0x44(%rbp),%esi
  mov    -0x48(%rbp),%eax
  mov    $0x0,%r9d
  mov    %rcx,%r8
  mov    $0x8,%ecx
  mov    %eax,%edi
  call   <clGetKernelWorkGroupInfo@plt>
  movl   $0x0,-0x40(%rbp)
  movq   $0x1,-0x28(%rbp)
  movl   $0x0,-0x3c(%rbp)
  jmp    L38
L47:
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x60(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jbe    L37
  movl   $0x1,-0x40(%rbp)
L37:
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x3c(%rbp),%eax
  cltq
  mov    -0x20(%rbp,%rax,8),%rax
  cmp    %rax,%rdx
  jbe    L27
  movl   $0x1,-0x40(%rbp)
L27:
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x28(%rbp),%rdx
  imul   %rdx,%rax
  mov    %rax,-0x28(%rbp)
  addl   $0x1,-0x3c(%rbp)
L38:
  mov    -0x3c(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L47
  mov    -0x38(%rbp),%rax
  cmp    %rax,-0x28(%rbp)
  jbe    L52
  movl   $0x1,-0x40(%rbp)
L52:
  mov    -0x30(%rbp),%rax
  cmp    %rax,-0x28(%rbp)
  jbe    L40
  movl   $0x1,-0x40(%rbp)
L40:
  mov    -0x40(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L66
  call   <__stack_chk_fail@plt>
L66:
  leave
  ret
```

assistant: ```c
int invalid_work_group_size(cl_device_id device, cl_kernel kernel, int dim, const size_t *local_work_size, const size_t *global_work_size) {
  size_t max_work_group_size;
  clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &max_work_group_size, NULL);
  size_t max_work_item_sizes[3];
  clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(max_work_item_sizes), max_work_item_sizes, NULL);
  size_t kernel_max_work_group_size;
  clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_WORK_GROUP_SIZE, sizeof(kernel_max_work_group_size), &kernel_max_work_group_size, NULL);
  int invalid = 0;
  size_t total_size = 1;
  for (int i = 0; i < dim; i++) {
    if (local_work_size[i] > global_work_size[i])
      invalid = 1;
    if (local_work_size[i] > max_work_item_sizes[i])
      invalid = 1;
    total_size *= local_work_size[i];
  }
  if (total_size > max_work_group_size)
    invalid = 1;
  if (total_size > kernel_max_work_group_size)
    invalid = 1;
  return invalid;
}
```