// File: /workspace/github_c_makefile_star2_O0/bmottershead[P]DBF2TSV/dbf.c
// Function: DBFWriteAttributeDirectly
int  DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,void *pValue) {
  int i, j;
  unsigned char *pabyRec;

  /* Is this a valid record? */
  if (hEntity < 0 || hEntity > psDBF->nRecords)
    return (FALSE);

  if (psDBF->bNoHeader)
    DBFWriteHeader(psDBF);

  /* Is this a brand new record? */
  if (hEntity == psDBF->nRecords) {
    if (!DBFFlushRecord(psDBF))
      return FALSE;

    psDBF->nRecords++;
    for (i = 0; i < psDBF->nRecordLength; i++)
      psDBF->pszCurrentRecord[i] = ' ';
    psDBF->nCurrentRecord = hEntity;
  }

  /* Is this an existing record, but different than the last one */
  /* we accessed? */
  if (!DBFLoadRecord(psDBF, hEntity))
    return FALSE;
  pabyRec = (unsigned char *) psDBF->pszCurrentRecord;

  /* Assign all the record fields. */
  if ((int) strlen((char *) pValue) > psDBF->panFieldSize[iField])
    j = psDBF->panFieldSize[iField];
  else {
    memset(pabyRec + psDBF->panFieldOffset[iField], ' ',psDBF->panFieldSize[iField]);
    j = strlen((char *) pValue);
  }

  strncpy((char *) (pabyRec + psDBF->panFieldOffset[iField]),(char *) pValue, j);
  psDBF->bCurrentRecordModified = TRUE;
  psDBF->bUpdated = TRUE;
  return (TRUE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x3058
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jle 0x3064
movl $0x0, -0x4(%rbp)
jmp 0x31b7
movq -0x10(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x3077
movq -0x10(%rbp), %rdi
callq 0x1670
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x30e2
movq -0x10(%rbp), %rdi
callq 0x17b0
cmpl $0x0, %eax
jne 0x309d
movl $0x0, -0x4(%rbp)
jmp 0x31b7
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x30d8
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x24(%rbp), %rcx
movb $0x20, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x30b1
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x31c0
cmpl $0x0, %eax
jne 0x30ff
movl $0x0, -0x4(%rbp)
jmp 0x31b7
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0x10c0
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rcx
movslq -0x18(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x3139
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
jmp 0x3176
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x18(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x18(%rbp), %rcx
movslq (%rax,%rcx,4), %rdx
movl $0x20, %esi
callq 0x10e0
movq -0x20(%rbp), %rdi
callq 0x10c0
movl %eax, -0x28(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x18(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movslq -0x28(%rbp), %rdx
callq 0x1040
movq -0x10(%rbp), %rax
movl $0x1, 0x44(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x64(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq