user: What is the c source code of the assembly code below?

```asm
<bitmap_load_any>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    $0x2e,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L109
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  jmp    L124
L109:
  addq   $0x1,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  lea    D73(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L10
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <bitmap_load_raw@plt>
  jmp    L124
L10:
  mov    -0x8(%rbp),%rax
  lea    D8(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L121
  mov    -0x8(%rbp),%rax
  lea    D13(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L19
L121:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <bitmap_load_bmp@plt>
  jmp    L124
L19:
  mov    -0x8(%rbp),%rax
  lea    D71(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L100
  mov    -0x8(%rbp),%rax
  lea    D87(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L73
L100:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <bitmap_load_pcx@plt>
  jmp    L124
L73:
  mov    -0x8(%rbp),%rax
  lea    D21(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L91
  mov    -0x8(%rbp),%rax
  lea    D29(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L95
L91:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <bitmap_load_sgi_rgb@plt>
  jmp    L124
L95:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
L124:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D18
datatype: string
name: disassemble_data
arguments: tag: D73
datatype: string
name: disassemble_data
arguments: tag: D8
datatype: string
name: disassemble_data
arguments: tag: D13
datatype: string
name: disassemble_data
arguments: tag: D71
datatype: string
name: disassemble_data
arguments: tag: D87
datatype: string
name: disassemble_data
arguments: tag: D21
datatype: string
name: disassemble_data
arguments: tag: D29
datatype: string
name: disassemble_data
arguments: tag: D12
datatype: string

tool: D18: bitmap: cannot determine type of %s


tool: D73: raw

tool: D8: bmp

tool: D13: BMP

tool: D71: pcx

tool: D87: PCX

tool: D21: rgb

tool: D29: RGB

tool: D12: bitmap: bitmap type %s not supported.


assistant: ```c
struct bitmap *bitmap_load_any(const char *path) {
  char *tail = strrchr(path, '.');
  if (!tail) {
    printf("bitmap: cannot determine type of %s\n", path);
    return 0;
  }
  tail++;
  if (!strcmp(tail, "raw")) {
    return bitmap_load_raw(path);
  } else if (!strcmp(tail, "bmp") || !strcmp(tail, "BMP")) {
    return bitmap_load_bmp(path);
  } else if (!strcmp(tail, "pcx") || !strcmp(tail, "PCX")) {
    return bitmap_load_pcx(path);
  } else if (!strcmp(tail, "rgb") || !strcmp(tail, "RGB")) {
    return bitmap_load_sgi_rgb(path);
  } else {
    printf("bitmap: bitmap type %s not supported.\n", tail);
    return 0;
  }
}
```