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

```asm
<FlashProgram>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  and    $0x3,%esi
  jne    L24
L139:
  test   $0x3,%dl
  jne    L155
  movq   $0x1,0x400fd014
  mov    0x400fe1a0,%rax
  test   $0x1,%al
  je     L167
  test   %rdx,%rdx
  je     L13
  nopl   0x0(%rax,%rax,1)
L65:
  mov    %rbx,%rax
  lea    (%rbx,%rdx,1),%rsi
  and    $0xffffffffffffff80,%rax
  mov    %rax,0x400fd000
  jmp    L77
  nopl   (%rax)
L59:
  mov    0x0(%rbp),%rax
  add    $0x8,%rbp
  sub    $0x4,%rdx
  mov    %rax,0x400fd100(%rcx)
L77:
  mov    %rsi,%rax
  sub    %rdx,%rax
  mov    %rax,%rcx
  and    $0x7c,%ecx
  jne    L57
  mov    0x400fd030,%rdi
  test   %rdi,%rdi
  jne    L162
L57:
  test   %rdx,%rdx
  jne    L59
L162:
  mov    $0xa4420001,%ebx
  mov    %rbx,0x400fd020
L101:
  mov    0x400fd020,%rcx
  and    $0x1,%ecx
  jne    L101
  test   %rdx,%rdx
  je     L13
  mov    %rax,%rbx
  jmp    L65
L167:
  test   %rdx,%rdx
  je     L13
L71:
  mov    %rbx,%rax
  lea    (%rbx,%rdx,1),%rsi
  mov    $0xa4420001,%ecx
  neg    %rax
  lea    0x0(%rbp,%rax,2),%rdi
  mov    %rbx,%rax
  nopl   0x0(%rax,%rax,1)
L88:
  mov    %rax,0x400fd000
  mov    (%rdi,%rax,2),%rdx
  mov    %rdx,0x400fd004
  mov    %rcx,0x400fd008
  nopl   0x0(%rax)
L128:
  mov    0x400fd008,%rdx
  and    $0x1,%edx
  jne    L128
  add    $0x4,%rax
  cmp    %rax,%rsi
  jne    L88
L13:
  mov    0x400fd00c,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  and    $0x1,%eax
  neg    %rax
  ret
L155:
  mov    $0xc9,%esi
  lea    D1(%rip),%rdi
  mov    %rdx,0x8(%rsp)
  call   <AssertFailure@plt>
  mov    0x8(%rsp),%rdx
  movq   $0x1,0x400fd014
  mov    0x400fe1a0,%rax
  test   $0x1,%al
  jne    L65
  jmp    L71
L24:
  mov    $0xc8,%esi
  lea    D1(%rip),%rdi
  mov    %rdx,0x8(%rsp)
  call   <AssertFailure@plt>
  mov    0x8(%rsp),%rdx
  jmp    L139
```

tool_calls: name: read_data
arguments: data_label: D1
type_guessed: string

tool: D1: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/lib/driverlib/flashlib.c

assistant: ```c
long FlashProgram(unsigned long *pulData, unsigned long ulAddress, unsigned long ulCount) {
  {
    if (!(!(ulAddress & 3))) {
      AssertFailure("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/lib/driverlib/flashlib.c", 200);
    }
  };
  {
    if (!(!(ulCount & 3))) {
      AssertFailure("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/lib/driverlib/flashlib.c", 201);
    }
  };
  (*((volatile unsigned long *)(0x400FD014))) = 0x00000001;
  if ((*((volatile unsigned long *)(0x400FE1A0))) & 0x00000001) {
    while (ulCount) {
      (*((volatile unsigned long *)(0x400FD000))) = ulAddress & ~(0x7f);
      while (((ulAddress & 0x7c) || ((*((volatile unsigned long *)(0x400FD030))) == 0)) && (ulCount != 0)) {
        (*((volatile unsigned long *)(0x400FD100 + (ulAddress & 0x7c)))) = *pulData++;
        ulAddress += 4;
        ulCount -= 4;
      }
      (*((volatile unsigned long *)(0x400FD020))) = 0xA4420000 | 0x00000001;
      while ((*((volatile unsigned long *)(0x400FD020))) & 0x00000001) {
      }
    }
  } else {
    while (ulCount) {
      (*((volatile unsigned long *)(0x400FD000))) = ulAddress;
      (*((volatile unsigned long *)(0x400FD004))) = *pulData;
      (*((volatile unsigned long *)(0x400FD008))) = 0xA4420000 | 0x00000001;
      while ((*((volatile unsigned long *)(0x400FD008))) & 0x00000001) {
      }
      pulData++;
      ulAddress += 4;
      ulCount -= 4;
    }
  }
  if ((*((volatile unsigned long *)(0x400FD00C))) & 0x00000001) {
    return (-1);
  }
  return (0);
}
```