user: Translate the below assembly code into C programming language:

```asm
<ConvertMode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movq   $0x0,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <S_ISDIR@plt>
  test   %rax,%rax
  je     L7
  orq    $0x1,-0x8(%rbp)
L7:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <S_ISCHR@plt>
  test   %rax,%rax
  je     L31
  orq    $0x2,-0x8(%rbp)
L31:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <S_ISBLK@plt>
  test   %rax,%rax
  je     L61
  orq    $0x4,-0x8(%rbp)
L61:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <S_ISREG@plt>
  test   %rax,%rax
  je     L25
  orq    $0x8,-0x8(%rbp)
L25:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <S_ISFIFO@plt>
  test   %rax,%rax
  je     L115
  orq    $0x10,-0x8(%rbp)
L115:
  mov    D21(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L94
  orq    $0x10000,-0x8(%rbp)
L94:
  mov    D36(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L65
  orq    $0x20000,-0x8(%rbp)
L65:
  mov    D80(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L90
  orq    $0x40000,-0x8(%rbp)
L90:
  mov    D16(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L133
  orq    $0x80000,-0x8(%rbp)
L133:
  mov    D27(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L112
  orq    $0x100000,-0x8(%rbp)
L112:
  mov    D54(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L126
  orq    $0x200000,-0x8(%rbp)
L126:
  mov    D100(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L144
  orq    $0x400000,-0x8(%rbp)
L144:
  mov    D71(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L116
  orq    $0x800000,-0x8(%rbp)
L116:
  mov    D108(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L32
  orq    $0x1000000,-0x8(%rbp)
L32:
  mov    D18(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L77
  orq    $0x2000000,-0x8(%rbp)
L77:
  mov    D88(%rip),%rax
  mov    (%rax),%rax
  and    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L20
  orq    $0x4000000,-0x8(%rbp)
L20:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
unsigned long ConvertMode(unsigned long posix_mode) {
  unsigned long result = 0;
  if (S_ISDIR(posix_mode))
    result |= 1 << 0;
  if (S_ISCHR(posix_mode))
    result |= 1 << 1;
  if (S_ISBLK(posix_mode))
    result |= 1 << 2;
  if (S_ISREG(posix_mode))
    result |= 1 << 3;
  if (S_ISFIFO(posix_mode))
    result |= 1 << 4;
  if (posix_mode & S_IRUSR)
    result |= 1 << 16;
  if (posix_mode & S_IWUSR)
    result |= 1 << 17;
  if (posix_mode & S_IXUSR)
    result |= 1 << 18;
  if (posix_mode & S_IRGRP)
    result |= 1 << 19;
  if (posix_mode & S_IWGRP)
    result |= 1 << 20;
  if (posix_mode & S_IXGRP)
    result |= 1 << 21;
  if (posix_mode & S_IROTH)
    result |= 1 << 22;
  if (posix_mode & S_IWOTH)
    result |= 1 << 23;
  if (posix_mode & S_IXOTH)
    result |= 1 << 24;
  if (posix_mode & S_ISUID)
    result |= 1 << 25;
  if (posix_mode & S_ISGID)
    result |= 1 << 26;
  return result;
}
```