// File: /workspace/github_c_makefile_star2_O3/inflex[P]ripMIME/MIME_headers.c
// Function: MIMEH_headers_get
int MIMEH_headers_get( struct MIMEH_header_info *hinfo, FFGET_FILE *f )
{
    int result = 0;

    // Setup some basic defaults
    hinfo->filename[0] = '\0';
    hinfo->name[0] = '\0';
    hinfo->content_type = _CTYPE_UNKNOWN;
    hinfo->subject[0] = '\0';
    hinfo->charset[0] = '\0';

    // 20040116-1234:PLD - added to appease valgrind
    hinfo->content_disposition = 0;
    hinfo->content_transfer_encoding = 0;
    hinfo->boundary_located = 0;

    hinfo->crlf_count=0;
    hinfo->crcr_count=0;
    hinfo->lf_count=0;

    if (f->linebreak == (FFGET_LINEBREAK_CR|FFGET_LINEBREAK_LF)) {
        if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_headers_get:DEBUG: Setting to CRLF based on ffget value of %d", FL, f->linebreak);
        snprintf(hinfo->delimeter,sizeof(hinfo->delimeter),"\r\n");
        hinfo->crlf_count = 1;
    } else if (f->linebreak == FFGET_LINEBREAK_LF) {
        if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_headers_get:DEBUG: Setting to LF based on ffget value of %d", FL, f->linebreak);
        snprintf(hinfo->delimeter,sizeof(hinfo->delimeter),"\n");
        hinfo->lf_count = 1;
    } else {
        if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_headers_get:DEBUG: ffget value of %d offered us no guide for the delimeter", FL, f->linebreak);
    }



    // Initialise header defects array.
    hinfo->header_defect_count = 0;
    memset(hinfo->defects, 0, sizeof(int) *_MIMEH_DEFECT_ARRAY_SIZE);

    snprintf( hinfo->content_type_string, _MIMEH_CONTENT_TYPE_MAX , "text/plain" );


    // Read from the file, the headers we need
    FFGET_set_watch_SDL(1);
    result = MIMEH_read_headers(hinfo, f);
    FFGET_set_watch_SDL(0);

    if (hinfo->lf_count > hinfo->crlf_count) {
        snprintf(hinfo->delimeter,sizeof(hinfo->delimeter),"\n");
    }

    // If we ran out of input whilst looking at headers, then, we basically
    // flag this, free up the headers, and return.
    if (result == -1)
    {
        if (glb.headerline) free(glb.headerline);
        return result;
    }

    // If we came back with an OKAY result, but there's nothing in the
    //  headers, then flag off an error
    if (glb.headerline == NULL)
    {
        if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIME_parse_headers:DEBUG: null headerline\n", FL);
        return 1;
    }

    return result;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
movb %al, 0x5efd(%rdi)
movb %al, 0x6efe(%rdi)
movl %eax, 0x27f8(%rdi)
movb %al, 0x59fc(%rdi)
movb %al, 0x17b05(%rdi)
movl %eax, 0x17100(%rdi)
movl %eax, 0x166f8(%rdi)
movl %eax, 0x59f8(%rdi)
movq $0x0, 0x18d3c(%rdi)
movl %eax, 0x18d44(%rdi)
movl 0x205c(%rsi), %ecx
movl 0x21547(%rip), %eax     # 0x2c38c
cmpl $0x1, %ecx
je 0xae8e
cmpl $0x3, %ecx
jne 0xaec6
testl %eax, %eax
jle 0xae72
leaq 0xc084(%rip), %rdi      # 0x16ede
leaq 0xa47d(%rip), %rsi      # 0x152de
movl $0xbb3, %edx            # imm = 0xBB3
movl $0x3, %ecx
xorl %eax, %eax
callq 0xc84f
movb $0x0, 0x18d3a(%rbx)
movw $0xa0d, 0x18d38(%rbx)   # imm = 0xA0D
movl $0x1, 0x18d3c(%rbx)
jmp 0xaee4
testl %eax, %eax
jle 0xaeb1
leaq 0xc08f(%rip), %rdi      # 0x16f28
leaq 0xa43e(%rip), %rsi      # 0x152de
movl $0xbb7, %edx            # imm = 0xBB7
movl $0x1, %ecx
xorl %eax, %eax
callq 0xc84f
movw $0xa, 0x18d38(%rbx)
movl $0x1, 0x18d44(%rbx)
jmp 0xaee4
testl %eax, %eax
jle 0xaee4
leaq 0xc09f(%rip), %rdi      # 0x16f70
leaq 0xa406(%rip), %rsi      # 0x152de
movl $0xbbb, %edx            # imm = 0xBBB
xorl %eax, %eax
callq 0xc84f
leaq 0x18b98(%rbx), %rdi
movl $0x194, %edx            # imm = 0x194
xorl %esi, %esi
callq 0x2170
movabsq $0x616c702f74786574, %rax # imm = 0x616C702F74786574
movq %rax, 0x27fc(%rbx)
movl $0x6e6961, 0x2803(%rbx) # imm = 0x6E6961
movl $0x1, %edi
callq 0x7624
movq %rbx, %rdi
movq %r14, %rsi
callq 0x86d4
movl %eax, %ebp
xorl %edi, %edi
callq 0x7624
movl 0x18d44(%rbx), %eax
cmpl 0x18d3c(%rbx), %eax
jle 0xaf47
movw $0xa, 0x18d38(%rbx)
movq 0x21422(%rip), %rdi     # 0x2c370
cmpl $-0x1, %ebp
je 0xaf84
xorl %ebx, %ebx
testq %rdi, %rdi
jne 0xaf93
movl $0x1, %ebx
cmpl $0x0, 0x21426(%rip)     # 0x2c38c
jle 0xaf93
leaq 0xc058(%rip), %rdi      # 0x16fc7
leaq 0xa368(%rip), %rsi      # 0x152de
movl $0xbdc, %edx            # imm = 0xBDC
xorl %eax, %eax
callq 0xc84f
jmp 0xaf93
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0xaf93
callq 0x2030
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq