user: 请从给定的汇编指令推导出C源代码：

```asm
<__glTexImage3D_size>:
  endbr64
  mov    %esi,%r10d
  mov    %edx,%r9d
  mov    %ecx,%esi
  mov    %ecx,%edx
  or     %r8d,%edx
  mov    $0x0,%eax
  or     %r9d,%edx
  jns    L21
L93:
  ret
L21:
  cmp    $0x93,%edi
  je     L262
  jle    L46
  lea    -0x94(%rdi),%ecx
  cmp    $0xc,%ecx
  ja     L276
  mov    $0x1,%eax
  shl    %cl,%rax
  test   $0x8ab,%eax
  jne    L201
  test   $0x12,%ah
  jne    L63
  cmp    $0xa,%ecx
  je     L269
  mov    $0x0,%eax
  ret
L46:
  cmp    $0x91,%edi
  je     L111
  cmp    $0x92,%edi
  je     L95
  mov    $0x4,%ecx
  cmp    $0x90,%edi
  jne    L75
L117:
  lea    -0x80(%r10),%eax
  cmp    $0x1a,%eax
  ja     L13
  mov    %eax,%eax
  lea    D9(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
L75:
  ret
L201:
  mov    $0x1,%ecx
L192:
  lea    -0x80(%r10),%eax
  cmp    $0x1c,%eax
  ja     L121
  mov    %eax,%eax
  lea    D2(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
L63:
  mov    $0x4,%ecx
  jmp    L192
L269:
  mov    $0x3,%ecx
  jmp    L192
  mov    $0x1,%edx
  jmp    L190
  mov    $0x0,%eax
  cmp    $0x99,%edi
  jne    L93
  lea    0xe(%r9),%eax
  add    $0x7,%r9d
  cmovns %r9d,%eax
  sar    $0x3,%eax
  imul   %esi,%eax
  imul   %r8d,%eax
  ret
  mov    $0x1,%edx
  mov    $0x1,%ecx
  jmp    L190
  mov    $0x2,%ecx
  mov    $0x2,%edx
  jmp    L190
  mov    $0x2,%ecx
  mov    $0x4,%edx
  jmp    L190
  mov    $0x4,%edx
  mov    $0x1,%ecx
  jmp    L190
  mov    $0x2,%edx
  mov    $0x1,%ecx
  jmp    L190
  mov    $0x1,%edx
  mov    $0x2,%ecx
  jmp    L190
  mov    $0x2,%edx
  mov    $0x1,%ecx
L190:
  mov    %ecx,%eax
  imul   %edx,%eax
  imul   %r9d,%eax
  imul   %esi,%eax
  imul   %r8d,%eax
  ret
L276:
  mov    $0x0,%eax
  ret
L121:
  mov    $0x0,%eax
  ret
L52:
  mov    $0x0,%eax
  ret
L13:
  mov    $0x0,%eax
  ret
L262:
  lea    -0x80(%r10),%eax
  cmp    $0x1a,%eax
  ja     L52
  mov    %eax,%eax
  lea    D4(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  mov    $0x2,%edx
  mov    $0x1,%ecx
  jmp    L190
  mov    $0x1,%edx
  mov    $0x1,%ecx
  jmp    L190
  mov    $0x4,%edx
  mov    $0x1,%ecx
  jmp    L190
L111:
  mov    $0x3,%ecx
  jmp    L117
L95:
  mov    $0x1,%ecx
  jmp    L117
  mov    $0x1,%edx
  mov    $0x1,%ecx
  jmp    L190
  mov    $0x4,%edx
  mov    $0x1,%ecx
  jmp    L190
```

assistant: ```c
GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d) {
  GLint elements, esize;
  if (w < 0)
    return 0;
  if (h < 0)
    return 0;
  if (d < 0)
    return 0;
  switch (format) {
  case GL_COLOR_INDEX:
    elements = 1;
    break;
  case GL_RED:
  case GL_GREEN:
  case GL_BLUE:
  case GL_ALPHA:
  case GL_LUMINANCE:
  case GL_INTENSITY:
    elements = 1;
    break;
  case GL_LUMINANCE_ALPHA:
    elements = 2;
    break;
  case GL_RGB:
  case GL_BGR:
    elements = 3;
    break;
  case GL_RGBA:
  case GL_BGRA:
  case GL_ABGR_EXT:
    elements = 4;
    break;
  default:
    return 0;
  }
  switch (type) {
  case GL_BITMAP:
    if (format == GL_COLOR_INDEX) {
      return (d * (h * ((w + 7) / 8)));
    } else {
      return 0;
    }
  case GL_BYTE:
  case GL_UNSIGNED_BYTE:
    esize = 1;
    break;
  case GL_UNSIGNED_BYTE_3_3_2:
  case GL_UNSIGNED_BYTE_2_3_3_REV:
    esize = 1;
    elements = 1;
    break;
  case GL_SHORT:
  case GL_UNSIGNED_SHORT:
    esize = 2;
    break;
  case GL_UNSIGNED_SHORT_5_6_5:
  case GL_UNSIGNED_SHORT_5_6_5_REV:
  case GL_UNSIGNED_SHORT_4_4_4_4:
  case GL_UNSIGNED_SHORT_4_4_4_4_REV:
  case GL_UNSIGNED_SHORT_5_5_5_1:
  case GL_UNSIGNED_SHORT_1_5_5_5_REV:
    esize = 2;
    elements = 1;
    break;
  case GL_INT:
  case GL_UNSIGNED_INT:
  case GL_FLOAT:
    esize = 4;
    break;
  case GL_UNSIGNED_INT_8_8_8_8:
  case GL_UNSIGNED_INT_8_8_8_8_REV:
  case GL_UNSIGNED_INT_10_10_10_2:
  case GL_UNSIGNED_INT_2_10_10_10_REV:
    esize = 4;
    elements = 1;
    break;
  default:
    return 0;
  }
  return (elements * esize * w * h * d);
}
```