// File: /workspace/github_c_makefile_star2_O0/sonicse[P]dbf2mysql/dbf2mysql.c
// Function: do_substitute
void do_substitute(char *subarg, dbhead *dbh) {
    /* NOTE: subarg is modified in this function */
    int i, bad;
    char *p, *oldname, *newname;
    if (subarg == NULL) return;

    if (verbose > 1) {
        printf("Substituting new field names\n");
    }
    /* use strstr instead of strtok because of possible empty tokens */
    oldname = subarg;
    while (oldname && strlen(oldname) && (p = strstr(oldname, "="))) {
        *p = '\0'; /* mark end of oldname */
        newname = ++p; /* point past \0 of oldname */
        if (strlen(newname)) { /* if not an empty string */
            p = strstr(newname, ",");
            if (p) {
                *p = '\0'; /* mark end of newname */
                p++; /* point past where the comma was */
            }
        }
        if (strlen(newname) >= DBF_NAMELEN) {
            printf("Truncating new field name %s to %d chars\n",
                    newname, DBF_NAMELEN - 1);
            newname[DBF_NAMELEN - 1] = '\0';
        }
        bad = 1;
        for (i = 0; i < dbh->db_nfields; i++) {
            if (strcmp(dbh->db_fields[i].db_name, oldname) == 0) {
                bad = 0;
                strcpy(dbh->db_fields[i].db_name, newname);
                if (verbose > 1) {
                    printf("Substitute old:%s new:%s\n",
                            oldname, newname);
                }
                break;
            }
        }
        if (bad) {
            printf("Warning: old field name %s not found\n",
                    oldname);
        }
        oldname = p;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x273c
jmp 0x28e3
cmpl $0x1, 0x8b65(%rip)      # 0xb2a8
jle 0x2753
leaq 0x5bd1(%rip), %rdi      # 0x831d
movb $0x0, %al
callq 0x2050
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x31(%rbp)
je 0x279c
movq -0x28(%rbp), %rdi
callq 0x20c0
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x31(%rbp)
je 0x279c
movq -0x28(%rbp), %rdi
leaq 0x5d82(%rip), %rsi      # 0x850b
callq 0x2070
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
setne %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x27a8
jmp 0x28e3
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x20c0
cmpq $0x0, %rax
je 0x27fe
movq -0x30(%rbp), %rdi
leaq 0x5ea4(%rip), %rsi      # 0x867d
callq 0x2070
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x27fc
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x27fe
movq -0x30(%rbp), %rdi
callq 0x20c0
cmpq $0xb, %rax
jb 0x282c
movq -0x30(%rbp), %rsi
leaq 0x5b23(%rip), %rdi      # 0x833b
movl $0xa, %edx
movb $0x0, %al
callq 0x2050
movq -0x30(%rbp), %rax
movb $0x0, 0xa(%rax)
movl $0x1, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x32(%rcx), %ecx
cmpl %ecx, %eax
jge 0x28be
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0xf, %rax, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0x2280
cmpl $0x0, %eax
jne 0x28ae
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0xf, %rax, %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2190
cmpl $0x1, 0x8a14(%rip)      # 0xb2a8
jle 0x28ac
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq 0x5ac0(%rip), %rdi      # 0x8365
movb $0x0, %al
callq 0x2050
jmp 0x28be
jmp 0x28b0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x283a
cmpl $0x0, -0x18(%rbp)
je 0x28d6
movq -0x28(%rbp), %rsi
leaq 0x5ab0(%rip), %rdi      # 0x837f
movb $0x0, %al
callq 0x2050
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x275b
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)