user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ft_power>:
  endbr64
  sub    $0x18,%rsp
  fldz
  fldt   0x30(%rsp)
  fucomi %st(1),%st
  fstp   %st(1)
  jp     L34
  je     L114
L34:
  fldz
  fcomi  %st(1),%st
  ja     L86
  fxch   %st(1)
  fnstcw 0xe(%rsp)
  movzwl 0xe(%rsp),%eax
  or     $0xc,%ah
  mov    %ax,0xc(%rsp)
  fld    %st(0)
  fldcw  0xc(%rsp)
  fistpl 0x8(%rsp)
  fldcw  0xe(%rsp)
  mov    0x8(%rsp),%eax
  test   $0x1,%al
  jne    L77
  fmuls  0xead(%rip)        # 2000 <_fini+0xcec>
  fucomi %st(1),%st
  fstp   %st(1)
  jp     L121
  je     L146
L121:
  fldz
  fcomip %st(1),%st
  ja     L83
  fld    %st(0)
  fldcw  0xc(%rsp)
  fistpl 0x8(%rsp)
  fldcw  0xe(%rsp)
  mov    0x8(%rsp),%eax
  test   $0x1,%al
  jne    L140
  fmuls  0xe77(%rip)        # 2000 <_fini+0xcec>
  sub    $0x10,%rsp
  fstpt  (%rsp)
  push   0x38(%rsp)
  push   0x38(%rsp)
  call   <ft_power>
  add    $0x20,%rsp
  fmul   %st(0),%st
  fmul   %st(0),%st
  jmp    L153
  nopw   0x0(%rax,%rax,1)
L110:
  fstp   %st(1)
L153:
  add    $0x18,%rsp
  ret
  nopw   0x0(%rax,%rax,1)
L77:
  fld1
  fsubrp %st,%st(1)
  fucomi %st(1),%st
  fstp   %st(1)
  jp     L2
  fldt   0x20(%rsp)
  je     L110
  fstp   %st(0)
L2:
  fldz
  fcomip %st(1),%st
  ja     L88
  fld    %st(0)
  fldcw  0xc(%rsp)
  fistpl 0x8(%rsp)
  fldcw  0xe(%rsp)
  mov    0x8(%rsp),%eax
  test   $0x1,%al
  jne    L6
  fmuls  0xe04(%rip)        # 2000 <_fini+0xcec>
  sub    $0x10,%rsp
  fstpt  (%rsp)
  push   0x38(%rsp)
  push   0x38(%rsp)
  call   <ft_power>
  add    $0x20,%rsp
  fmul   %st(0),%st
  fldt   0x20(%rsp)
  fmulp  %st,%st(1)
  jmp    L153
  xchg   %ax,%ax
L114:
  fstp   %st(0)
  jmp    L70
  nopl   0x0(%rax)
L146:
  fstp   %st(0)
L70:
  fld1
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax)
L86:
  fstp   %st(0)
  fchs
  sub    $0x10,%rsp
  fstpt  (%rsp)
  push   0x38(%rsp)
  push   0x38(%rsp)
  call   <ft_power>
  add    $0x20,%rsp
  fld1
  fdivp  %st,%st(1)
  jmp    L153
  nopl   (%rax)
L140:
  fld1
  sub    $0x10,%rsp
  fsubrp %st,%st(1)
  fstpt  (%rsp)
  push   0x38(%rsp)
  push   0x38(%rsp)
  call   <ft_power>
  fldt   0x40(%rsp)
  add    $0x20,%rsp
  fmulp  %st,%st(1)
  fmul   %st(0),%st
  jmp    L153
  nopl   0x0(%rax)
L6:
  fld1
  sub    $0x10,%rsp
  fsubrp %st,%st(1)
  fstpt  (%rsp)
  push   0x38(%rsp)
  push   0x38(%rsp)
  call   <ft_power>
  fldt   0x40(%rsp)
  add    $0x20,%rsp
  fmul   %st,%st(1)
  fmulp  %st,%st(1)
  jmp    L153
  nopl   0x0(%rax)
L83:
  fchs
  sub    $0x10,%rsp
  fstpt  (%rsp)
  push   0x38(%rsp)
  push   0x38(%rsp)
  call   <ft_power>
  add    $0x20,%rsp
  fld1
  fdivp  %st,%st(1)
  fmul   %st(0),%st
  jmp    L153
  nopl   (%rax)
L88:
  fchs
  sub    $0x10,%rsp
  fstpt  (%rsp)
  push   0x38(%rsp)
  push   0x38(%rsp)
  call   <ft_power>
  add    $0x20,%rsp
  fld1
  fdivp  %st,%st(1)
  fldt   0x20(%rsp)
  fmulp  %st,%st(1)
  jmp    L153
```

assistant: ```c
long double ft_power(long double base, long double ex) {
  long double half_pow;
  if (ex == 0)
    return (1);
  else if (ex < 0)
    return (1 / ft_power(base, -ex));
  else if ((int)ex % 2 == 0) {
    half_pow = ft_power(base, ex / 2);
    return (half_pow * half_pow);
  } else
    return (base * ft_power(base, ex - 1));
}
```