// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, 0x5efd(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x6efe(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x27f8(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x59fc(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x17b05(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x17100(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x166f8(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x59f8(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x18d3c(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x18d40(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x18d44(%rax)
movq -0x18(%rbp), %rax
cmpl $0x3, 0x205c(%rax)
jne 0xea20
cmpl $0x1, 0x23db3(%rip)     # 0x3277c
jl 0xe9ef
movq -0x18(%rbp), %rax
movl 0x205c(%rax), %ecx
leaq 0xf692(%rip), %rdi      # 0x1e06e
leaq 0xda8b(%rip), %rsi      # 0x1c46e
movl $0xbb3, %edx            # imm = 0xBB3
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rdi
addq $0x18d38, %rdi          # imm = 0x18D38
movl $0x3, %esi
leaq 0xd82e(%rip), %rdx      # 0x1c234
movb $0x0, %al
callq 0x2130
movq -0x10(%rbp), %rax
movl $0x1, 0x18d3c(%rax)
jmp 0xeab9
movq -0x18(%rbp), %rax
cmpl $0x1, 0x205c(%rax)
jne 0xea88
cmpl $0x1, 0x23d48(%rip)     # 0x3277c
jl 0xea5a
movq -0x18(%rbp), %rax
movl 0x205c(%rax), %ecx
leaq 0xf671(%rip), %rdi      # 0x1e0b8
leaq 0xda20(%rip), %rsi      # 0x1c46e
movl $0xbb7, %edx            # imm = 0xBB7
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rdi
addq $0x18d38, %rdi          # imm = 0x18D38
movl $0x3, %esi
leaq 0xaf95(%rip), %rdx      # 0x19a06
movb $0x0, %al
callq 0x2130
movq -0x10(%rbp), %rax
movl $0x1, 0x18d44(%rax)
jmp 0xeab7
cmpl $0x1, 0x23ced(%rip)     # 0x3277c
jl 0xeab5
movq -0x18(%rbp), %rax
movl 0x205c(%rax), %ecx
leaq 0xf65e(%rip), %rdi      # 0x1e100
leaq 0xd9c5(%rip), %rsi      # 0x1c46e
movl $0xbbb, %edx            # imm = 0xBBB
movb $0x0, %al
callq 0x117c0
jmp 0xeab7
jmp 0xeab9
movq -0x10(%rbp), %rax
movl $0x0, 0x18d28(%rax)
movq -0x10(%rbp), %rdi
addq $0x18b98, %rdi          # imm = 0x18B98
xorl %esi, %esi
movl $0x190, %edx            # imm = 0x190
callq 0x2150
movq -0x10(%rbp), %rdi
addq $0x27fc, %rdi           # imm = 0x27FC
movl $0x500, %esi            # imm = 0x500
leaq 0xeba1(%rip), %rdx      # 0x1d696
movb $0x0, %al
callq 0x2130
movl $0x1, %edi
callq 0x9490
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xb250
movl %eax, -0x1c(%rbp)
xorl %edi, %edi
callq 0x9490
movq -0x10(%rbp), %rax
movl 0x18d44(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18d3c(%rcx), %eax
jle 0xeb51
movq -0x10(%rbp), %rdi
addq $0x18d38, %rdi          # imm = 0x18D38
movl $0x3, %esi
leaq 0xaebc(%rip), %rdx      # 0x19a06
movb $0x0, %al
callq 0x2130
cmpl $-0x1, -0x1c(%rbp)
jne 0xeb75
cmpq $0x0, 0x23c01(%rip)     # 0x32760
je 0xeb6d
movq 0x23bf8(%rip), %rdi     # 0x32760
callq 0x2030
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xebb1
cmpq $0x0, 0x23be3(%rip)     # 0x32760
jne 0xebab
cmpl $0x1, 0x23bf6(%rip)     # 0x3277c
jl 0xeba2
leaq 0xf5c8(%rip), %rdi      # 0x1e157
leaq 0xd8d8(%rip), %rsi      # 0x1c46e
movl $0xbdc, %edx            # imm = 0xBDC
movb $0x0, %al
callq 0x117c0
movl $0x1, -0x4(%rbp)
jmp 0xebb1
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)