user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<iap_get_sector>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  cmpl   $0xfff,-0x4(%rbp)
  jg     L525
  mov    $0x0,%eax
  jmp    L407
L525:
  cmpl   $0xfff,-0x4(%rbp)
  jle    L393
  cmpl   $0x1fff,-0x4(%rbp)
  jg     L393
  mov    $0x1,%eax
  jmp    L407
L393:
  cmpl   $0x1fff,-0x4(%rbp)
  jle    L408
  cmpl   $0x2fff,-0x4(%rbp)
  jg     L408
  mov    $0x2,%eax
  jmp    L407
L408:
  cmpl   $0x2fff,-0x4(%rbp)
  jle    L672
  cmpl   $0x3fff,-0x4(%rbp)
  jg     L672
  mov    $0x3,%eax
  jmp    L407
L672:
  cmpl   $0x3fff,-0x4(%rbp)
  jle    L87
  cmpl   $0x4fff,-0x4(%rbp)
  jg     L87
  mov    $0x4,%eax
  jmp    L407
L87:
  cmpl   $0x4fff,-0x4(%rbp)
  jle    L671
  cmpl   $0x5fff,-0x4(%rbp)
  jg     L671
  mov    $0x5,%eax
  jmp    L407
L671:
  cmpl   $0x5fff,-0x4(%rbp)
  jle    L751
  cmpl   $0x6fff,-0x4(%rbp)
  jg     L751
  mov    $0x6,%eax
  jmp    L407
L751:
  cmpl   $0x6fff,-0x4(%rbp)
  jle    L444
  cmpl   $0x7fff,-0x4(%rbp)
  jg     L444
  mov    $0x7,%eax
  jmp    L407
L444:
  cmpl   $0x7fff,-0x4(%rbp)
  jle    L543
  cmpl   $0xffff,-0x4(%rbp)
  jg     L543
  mov    $0x8,%eax
  jmp    L407
L543:
  cmpl   $0xffff,-0x4(%rbp)
  jle    L436
  cmpl   $0x17fff,-0x4(%rbp)
  jg     L436
  mov    $0x9,%eax
  jmp    L407
L436:
  cmpl   $0x17fff,-0x4(%rbp)
  jle    L303
  cmpl   $0x1ffff,-0x4(%rbp)
  jg     L303
  mov    $0xa,%eax
  jmp    L407
L303:
  cmpl   $0x1ffff,-0x4(%rbp)
  jle    L664
  cmpl   $0x27fff,-0x4(%rbp)
  jg     L664
  mov    $0xb,%eax
  jmp    L407
L664:
  cmpl   $0x27fff,-0x4(%rbp)
  jle    L315
  cmpl   $0x2ffff,-0x4(%rbp)
  jg     L315
  mov    $0xc,%eax
  jmp    L407
L315:
  cmpl   $0x2ffff,-0x4(%rbp)
  jle    L388
  cmpl   $0x37fff,-0x4(%rbp)
  jg     L388
  mov    $0xd,%eax
  jmp    L407
L388:
  cmpl   $0x37fff,-0x4(%rbp)
  jle    L663
  cmpl   $0x3ffff,-0x4(%rbp)
  jg     L663
  mov    $0xe,%eax
  jmp    L407
L663:
  cmpl   $0x3ffff,-0x4(%rbp)
  jle    L101
  cmpl   $0x47fff,-0x4(%rbp)
  jg     L101
  mov    $0xf,%eax
  jmp    L407
L101:
  cmpl   $0x47fff,-0x4(%rbp)
  jle    L708
  cmpl   $0x4ffff,-0x4(%rbp)
  jg     L708
  mov    $0x10,%eax
  jmp    L407
L708:
  cmpl   $0x4ffff,-0x4(%rbp)
  jle    L466
  cmpl   $0x57fff,-0x4(%rbp)
  jg     L466
  mov    $0x11,%eax
  jmp    L407
L466:
  cmpl   $0x57fff,-0x4(%rbp)
  jle    L424
  cmpl   $0x5ffff,-0x4(%rbp)
  jg     L424
  mov    $0x12,%eax
  jmp    L407
L424:
  cmpl   $0x5ffff,-0x4(%rbp)
  jle    L269
  cmpl   $0x67fff,-0x4(%rbp)
  jg     L269
  mov    $0x13,%eax
  jmp    L407
L269:
  cmpl   $0x67fff,-0x4(%rbp)
  jle    L93
  cmpl   $0x6ffff,-0x4(%rbp)
  jg     L93
  mov    $0x14,%eax
  jmp    L407
L93:
  cmpl   $0x6ffff,-0x4(%rbp)
  jle    L313
  cmpl   $0x77fff,-0x4(%rbp)
  jg     L313
  mov    $0x15,%eax
  jmp    L407
L313:
  cmpl   $0x77fff,-0x4(%rbp)
  jle    L750
  cmpl   $0x78fff,-0x4(%rbp)
  jg     L750
  mov    $0x16,%eax
  jmp    L407
L750:
  cmpl   $0x78fff,-0x4(%rbp)
  jle    L118
  cmpl   $0x79fff,-0x4(%rbp)
  jg     L118
  mov    $0x17,%eax
  jmp    L407
L118:
  cmpl   $0x79fff,-0x4(%rbp)
  jle    L656
  cmpl   $0x7afff,-0x4(%rbp)
  jg     L656
  mov    $0x18,%eax
  jmp    L407
L656:
  cmpl   $0x7afff,-0x4(%rbp)
  jle    L86
  cmpl   $0x7bfff,-0x4(%rbp)
  jg     L86
  mov    $0x19,%eax
  jmp    L407
L86:
  cmpl   $0x7bfff,-0x4(%rbp)
  jle    L35
  cmpl   $0x7cfff,-0x4(%rbp)
  jg     L35
  mov    $0x1a,%eax
  jmp    L407
L35:
  cmpl   $0x7cfff,-0x4(%rbp)
  jle    L217
  cmpl   $0x7dfff,-0x4(%rbp)
  jg     L217
  mov    $0x1b,%eax
  jmp    L407
L217:
  mov    $0xff,%eax
L407:
  pop    %rbp
  ret
```

assistant: ```c
uint8_t iap_get_sector(uint32_t addr) {
  if (addr <= 0x00000FFF) {
    return 0;
  }
  if ((addr >= 0x00001000) && (addr <= 0x00001FFF)) {
    return 1;
  }
  if ((addr >= 0x00002000) && (addr <= 0x00002FFF)) {
    return 2;
  }
  if ((addr >= 0x00003000) && (addr <= 0x00003FFF)) {
    return 3;
  }
  if ((addr >= 0x00004000) && (addr <= 0x00004FFF)) {
    return 4;
  }
  if ((addr >= 0x00005000) && (addr <= 0x00005FFF)) {
    return 5;
  }
  if ((addr >= 0x00006000) && (addr <= 0x00006FFF)) {
    return 6;
  }
  if ((addr >= 0x00007000) && (addr <= 0x00007FFF)) {
    return 7;
  }
  if ((addr >= 0x00008000) && (addr <= 0x0000FFFF)) {
    return 8;
  }
  if ((addr >= 0x00010000) && (addr <= 0x00017FFF)) {
    return 9;
  }
  if ((addr >= 0x00018000) && (addr <= 0x0001FFFF)) {
    return 10;
  }
  if ((addr >= 0x00020000) && (addr <= 0x00027FFF)) {
    return 11;
  }
  if ((addr >= 0x00028000) && (addr <= 0x0002FFFF)) {
    return 12;
  }
  if ((addr >= 0x00030000) && (addr <= 0x00037FFF)) {
    return 13;
  }
  if ((addr >= 0x00038000) && (addr <= 0x0003FFFF)) {
    return 14;
  }
  if ((addr >= 0x00040000) && (addr <= 0x00047FFF)) {
    return 15;
  }
  if ((addr >= 0x00048000) && (addr <= 0x0004FFFF)) {
    return 16;
  }
  if ((addr >= 0x00050000) && (addr <= 0x00057FFF)) {
    return 17;
  }
  if ((addr >= 0x00058000) && (addr <= 0x0005FFFF)) {
    return 18;
  }
  if ((addr >= 0x00060000) && (addr <= 0x00067FFF)) {
    return 19;
  }
  if ((addr >= 0x00068000) && (addr <= 0x0006FFFF)) {
    return 20;
  }
  if ((addr >= 0x00070000) && (addr <= 0x00077FFF)) {
    return 21;
  }
  if ((addr >= 0x00078000) && (addr <= 0x00078FFF)) {
    return 22;
  }
  if ((addr >= 0x00079000) && (addr <= 0x00079FFF)) {
    return 23;
  }
  if ((addr >= 0x0007A000) && (addr <= 0x0007AFFF)) {
    return 24;
  }
  if ((addr >= 0x0007B000) && (addr <= 0x0007BFFF)) {
    return 25;
  }
  if ((addr >= 0x0007C000) && (addr <= 0x0007CFFF)) {
    return 26;
  }
  if ((addr >= 0x0007D000) && (addr <= 0x0007DFFF)) {
    return 27;
  }
  return (0xFF);
}
```