// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/tnef/tnef.c
// Function: read_attribute
int read_attribute(uint8 *tsp)
{

	int bytes = 0, header = 0;
	int rv = 0;
	uint32 attribute;
	uint8 component = 0;
	uint32 size = 0;
	uint16 checksum = 0;
	static char attach_title[256] = {
		0				};
	static uint32 attach_size = 0;
	//static uint32 attach_loc  = 0; // 2003-02-22-1231-PLD
	static uint8 *attach_loc  = 0;

	component = *tsp;

	bytes += sizeof(uint8);

	// Read the attributes of this component

	if (TNEF_DEBUG) LOGGER_log("%s:%d:TNEF_read_attribute:DEBUG: Reading Attribute...\n",FL);
	rv = read_32(&attribute, tsp+bytes);
	if (rv == -1) return -1;
	bytes += sizeof(attribute);

	// Read the size of the information we have to read

	if (TNEF_DEBUG) LOGGER_log("%s:%d:TNEF_read_attribute: Reading Size...\n",FL);
	rv = read_32(&size, tsp+bytes);
	if (rv == -1) return -1;
	bytes += sizeof(size);

	// The header size equals the sum of all the things we've read
	//  so far.

	header = bytes;

	// The is a bit of a tricky one [if you're being slow
	//  it moves the number of bytes ahead by the amount of data of
	//  the attribute we're about to read, so that for next
	//  "read_attribute()"
	//  call starts in the right place.

	bytes += size;

	// Read in the checksum for this component
	//
	// AMMENDMENT - 19/07/02 - 17H01
	// Small code change to deal with strange sitations that occur with non
	//		english characters. - Submitted by wtcheuk@netvigator.com @ 19/07/02

	if ( bytes < 0 ) return -1;

	// --END of ammendment.

	if (TNEF_DEBUG) LOGGER_log("%s:%d:TNEF_read_attribute:DEBUG: Reading Checksum...(offset %d, bytes=%d)\n", FL, tsp -TNEF_glb.tnef_home, bytes);
	if (read_16(&checksum, tsp+bytes) == -1) return -1;

	bytes += sizeof(checksum);

	if (TNEF_DEBUG) LOGGER_log("%s:%d:TNEF_read_attribute:DEBUG: Decoding attribute %d\n", FL, attribute);

	switch (attribute) {
		case attNull:
			default_handler(attribute, tsp+header, size);
			break;
		case attFrom:
			default_handler(attribute, tsp+header, size);
			break;
		case attSubject:
			break;
		case attDateSent:
			break;
		case attDateRecd:
			break;
		case attMessageStatus:
			break;
		case attMessageClass:
			break;
		case attMessageID:
			break;
		case attParentID:
			break;
		case attConversationID:
			break;
		case attBody:
			default_handler(attribute, tsp+header, size);
			break;
		case attPriority:
			break;
		case attAttachData:
			attach_size=size;
			//		attach_loc =(int)tsp+header; // 2003-02-22-1232-PLD
			attach_loc =(uint8 *)tsp+header;
			if (TNEF_glb.savedata && strlen(attach_title)>0 && attach_size > 0) {
				if (!save_attach_data(attach_title, (uint8 *)attach_loc,attach_size))
				{
					if (TNEF_VERBOSE) {
						if (TNEF_glb.filename_decoded_report == NULL)
						{
							LOGGER_log("Decoding: %s\n", attach_title);
						} else {
							TNEF_glb.filename_decoded_report( attach_title, (TNEF_glb.verbosity_contenttype>0?"tnef":NULL));
						}

					}
				}
				else
				{
					LOGGER_log("%s:%d:TNEF_read_attribute:ERROR: While saving attachment '%s'\n", FL, attach_title);
				}
			}
			break;
		case attAttachTitle:
			strncpy(attach_title, make_string(tsp+header,size),255);
			if (TNEF_glb.savedata && strlen(attach_title)>0 && attach_size > 0) {
				if (!save_attach_data(attach_title, (uint8 *)attach_loc,attach_size))
				{
					if (TNEF_VERBOSE) {
						if (TNEF_glb.filename_decoded_report == NULL)
						{
							LOGGER_log("Decoding: %s\n", attach_title);
						} else {
							TNEF_glb.filename_decoded_report( attach_title, (TNEF_glb.verbosity_contenttype>0?"tnef":NULL));
						}

					}
				}
				else
				{
					LOGGER_log("%s:%d:TNEF_read_attribute:ERROR: While saving attachment '%s'\n", FL, attach_title);
				}
			}
			break;
		case attAttachMetaFile:
			default_handler(attribute, tsp+header, size);
			break;
		case attAttachCreateDate:
			break;
		case attAttachModifyDate:
			break;
		case attDateModified:
			break;
		case attAttachTransportFilename:
			default_handler(attribute, tsp+header, size);
			break;
		case attAttachRenddata:
			attach_title[0]=0;
			attach_size=0;
			attach_loc=0;
			default_handler(attribute, tsp+header, size);
			break;
		case attMAPIProps:
			if (handle_props(tsp+header)==-1) return -1;
			break;
		case attRecipTable:
			default_handler(attribute, tsp+header, size);
			break;
		case attAttachment:
			default_handler(attribute, tsp+header, size);
			break;
		case attTnefVersion:
			{
				uint32 version;
				rv = read_32(&version, tsp+header);
				if (rv == -1) return -1;
			}
			break;
		case attOemCodepage:
			default_handler(attribute, tsp+header, size);
			break;
		case attOriginalMessageClass:
			break;
		case attOwner:
			default_handler(attribute, tsp+header, size);
			break;
		case attSentFor:
			default_handler(attribute, tsp+header, size);
			break;
		case attDelegate:
			default_handler(attribute, tsp+header, size);
			break;
		case attDateStart:
			break;
		case attDateEnd:
			break;
		case attAidOwner:
			default_handler(attribute, tsp+header, size);
			break;
		case attRequestRes:
			default_handler(attribute, tsp+header, size);
			break;
		default:
			default_handler(attribute, tsp+header, size);
			break;
	}
	return bytes;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movb $0x0, -0x21(%rbp)
movl $0x0, -0x28(%rbp)
movw $0x0, -0x2a(%rbp)
movq -0x10(%rbp), %rax
movb (%rax), %al
movb %al, -0x21(%rbp)
movslq -0x14(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x14(%rbp)
cmpl $0x0, 0x25aaf(%rip)     # 0x352dc
jle 0xf849
leaq 0xec97(%rip), %rdi      # 0x1e4cd
leaq 0xebfb(%rip), %rsi      # 0x1e438
movl $0x1fa, %edx            # imm = 0x1FA
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rax
addq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0xf0b0
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jne 0xf872
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffa5
movslq -0x14(%rbp), %rax
addq $0x4, %rax
movl %eax, -0x14(%rbp)
cmpl $0x0, 0x25a58(%rip)     # 0x352dc
jle 0xf8a0
leaq 0xec77(%rip), %rdi      # 0x1e504
leaq 0xeba4(%rip), %rsi      # 0x1e438
movl $0x201, %edx            # imm = 0x201
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rax
addq %rax, %rsi
leaq -0x28(%rbp), %rdi
callq 0xf0b0
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jne 0xf8c9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffa5
movslq -0x14(%rbp), %rax
addq $0x4, %rax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x28(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0xf8f5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffa5
cmpl $0x0, 0x259e0(%rip)     # 0x352dc
jle 0xf92a
movq -0x10(%rbp), %rcx
movq 0x25de7(%rip), %rax     # 0x356f0
subq %rax, %rcx
movl -0x14(%rbp), %r8d
leaq 0xec19(%rip), %rdi      # 0x1e530
leaq 0xeb1a(%rip), %rsi      # 0x1e438
movl $0x21d, %edx            # imm = 0x21D
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rax
addq %rax, %rsi
leaq -0x2a(%rbp), %rdi
callq 0xf210
cmpl $-0x1, %eax
jne 0xf94f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffa5
movslq -0x14(%rbp), %rax
addq $0x2, %rax
movl %eax, -0x14(%rbp)
cmpl $0x0, 0x2597b(%rip)     # 0x352dc
jle 0xf980
movl -0x20(%rbp), %ecx
leaq 0xec0e(%rip), %rdi      # 0x1e57b
leaq 0xeac4(%rip), %rsi      # 0x1e438
movl $0x222, %edx            # imm = 0x222
movb $0x0, %al
callq 0x117c0
movl -0x20(%rbp), %eax
movl %eax, -0x34(%rbp)
testl %eax, %eax
je 0xfb8f
jmp 0xf990
movl -0x34(%rbp), %eax
subl $0x8000, %eax           # imm = 0x8000
je 0xfbaa
jmp 0xf9a0
movl -0x34(%rbp), %eax
subl $0x18004, %eax          # imm = 0x18004
je 0xfbc5
jmp 0xf9b0
movl -0x34(%rbp), %eax
subl $0x18009, %eax          # imm = 0x18009
je 0xfbde
jmp 0xf9c0
movl -0x34(%rbp), %eax
subl $0x1800a, %eax          # imm = 0x1800A
je 0xfbe3
jmp 0xf9d0
movl -0x34(%rbp), %eax
subl $0x1800b, %eax          # imm = 0x1800B
je 0xfbe8
jmp 0xf9e0
movl -0x34(%rbp), %eax
subl $0x18010, %eax          # imm = 0x18010
je 0xfcf4
jmp 0xf9f0
movl -0x34(%rbp), %eax
subl $0x2800c, %eax          # imm = 0x2800C
je 0xfbed
jmp 0xfa00
movl -0x34(%rbp), %eax
subl $0x30006, %eax          # imm = 0x30006
je 0xff55
jmp 0xfa10
movl -0x34(%rbp), %eax
subl $0x30007, %eax          # imm = 0x30007
je 0xff57
jmp 0xfa20
movl -0x34(%rbp), %eax
subl $0x38005, %eax          # imm = 0x38005
je 0xfbca
jmp 0xfa30
movl -0x34(%rbp), %eax
subl $0x38006, %eax          # imm = 0x38006
je 0xfbcf
jmp 0xfa40
movl -0x34(%rbp), %eax
subl $0x38012, %eax          # imm = 0x38012
je 0xfe02
jmp 0xfa50
movl -0x34(%rbp), %eax
subl $0x38013, %eax          # imm = 0x38013
je 0xfe07
jmp 0xfa60
movl -0x34(%rbp), %eax
subl $0x38020, %eax          # imm = 0x38020
je 0xfe0c
jmp 0xfa70
movl -0x34(%rbp), %eax
subl $0x40009, %eax          # imm = 0x40009
je 0xff71
jmp 0xfa80
movl -0x34(%rbp), %eax
subl $0x4800d, %eax          # imm = 0x4800D
je 0xfc08
jmp 0xfa90
movl -0x34(%rbp), %eax
subl $0x50008, %eax          # imm = 0x50008
je 0xff59
jmp 0xfaa0
movl -0x34(%rbp), %eax
subl $0x60000, %eax          # imm = 0x60000
je 0xff0d
jmp 0xfab0
movl -0x34(%rbp), %eax
subl $0x60001, %eax          # imm = 0x60001
je 0xff25
jmp 0xfac0
movl -0x34(%rbp), %eax
subl $0x60002, %eax          # imm = 0x60002
je 0xff3d
jmp 0xfad0
movl -0x34(%rbp), %eax
subl $0x68007, %eax          # imm = 0x68007
je 0xfbd4
jmp 0xfae0
movl -0x34(%rbp), %eax
subl $0x6800f, %eax          # imm = 0x6800F
je 0xfc0d
jmp 0xfaf0
movl -0x34(%rbp), %eax
subl $0x68011, %eax          # imm = 0x68011
je 0xfde7
jmp 0xfb00
movl -0x34(%rbp), %eax
subl $0x69001, %eax          # imm = 0x69001
je 0xfe11
jmp 0xfb10
movl -0x34(%rbp), %eax
subl $0x69002, %eax          # imm = 0x69002
je 0xfe2c
jmp 0xfb20
movl -0x34(%rbp), %eax
subl $0x69003, %eax          # imm = 0x69003
je 0xfe63
jmp 0xfb30
movl -0x34(%rbp), %eax
subl $0x69004, %eax          # imm = 0x69004
je 0xfe89
jmp 0xfb40
movl -0x34(%rbp), %eax
subl $0x69005, %eax          # imm = 0x69005
je 0xfea4
jmp 0xfb50
movl -0x34(%rbp), %eax
subl $0x69007, %eax          # imm = 0x69007
je 0xfeed
jmp 0xfb60
movl -0x34(%rbp), %eax
subl $0x70006, %eax          # imm = 0x70006
je 0xff08
jmp 0xfb70
movl -0x34(%rbp), %eax
subl $0x78008, %eax          # imm = 0x78008
je 0xfbd9
jmp 0xfb7c
movl -0x34(%rbp), %eax
subl $0x89006, %eax          # imm = 0x89006
je 0xfebf
jmp 0xff89
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
jmp 0xff9f
movl -0x28(%rbp), %eax
movl %eax, 0x25cfa(%rip)     # 0x35910
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, 0x25cf0(%rip)     # 0x35918
cmpl $0x0, 0x25ab9(%rip)     # 0x356e8
je 0xfcef
leaq 0x25bd4(%rip), %rdi     # 0x35810
callq 0x2100
cmpq $0x0, %rax
jbe 0xfcef
cmpl $0x0, 0x25cbe(%rip)     # 0x35910
jbe 0xfcef
movq 0x25cb9(%rip), %rsi     # 0x35918
movl 0x25cab(%rip), %edx     # 0x35910
leaq 0x25ba4(%rip), %rdi     # 0x35810
callq 0xf310
cmpl $0x0, %eax
jne 0xfccc
cmpl $0x0, 0x25657(%rip)     # 0x352d4
jle 0xfcca
cmpq $0x0, 0x25a79(%rip)     # 0x35700
jne 0xfca0
leaq 0xacd3(%rip), %rdi      # 0x1a963
leaq 0x25b79(%rip), %rsi     # 0x35810
movb $0x0, %al
callq 0x117c0
jmp 0xfcc8
movq 0x25a59(%rip), %rax     # 0x35700
movl 0x2562b(%rip), %edx     # 0x352d8
xorl %ecx, %ecx
movl %ecx, %esi
leaq 0x963a(%rip), %rcx      # 0x192f2
cmpl $0x0, %edx
cmovgq %rcx, %rsi
leaq 0x25b4a(%rip), %rdi     # 0x35810
callq *%rax
jmp 0xfcca
jmp 0xfced
leaq 0xe8e0(%rip), %rdi      # 0x1e5b3
leaq 0xe75e(%rip), %rsi      # 0x1e438
movl $0x253, %edx            # imm = 0x253
leaq 0x25b2a(%rip), %rcx     # 0x35810
movb $0x0, %al
callq 0x117c0
jmp 0xfcef
jmp 0xff9f
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rax
addq %rax, %rdi
movl -0x28(%rbp), %esi
callq 0xf2d0
movq %rax, %rsi
leaq 0x25aff(%rip), %rdi     # 0x35810
movl $0xff, %edx
callq 0x2070
cmpl $0x0, 0x259c6(%rip)     # 0x356e8
je 0xfde2
leaq 0x25ae1(%rip), %rdi     # 0x35810
callq 0x2100
cmpq $0x0, %rax
jbe 0xfde2
cmpl $0x0, 0x25bcb(%rip)     # 0x35910
jbe 0xfde2
movq 0x25bc6(%rip), %rsi     # 0x35918
movl 0x25bb8(%rip), %edx     # 0x35910
leaq 0x25ab1(%rip), %rdi     # 0x35810
callq 0xf310
cmpl $0x0, %eax
jne 0xfdbf
cmpl $0x0, 0x25564(%rip)     # 0x352d4
jle 0xfdbd
cmpq $0x0, 0x25986(%rip)     # 0x35700
jne 0xfd93
leaq 0xabe0(%rip), %rdi      # 0x1a963
leaq 0x25a86(%rip), %rsi     # 0x35810
movb $0x0, %al
callq 0x117c0
jmp 0xfdbb
movq 0x25966(%rip), %rax     # 0x35700
movl 0x25538(%rip), %edx     # 0x352d8
xorl %ecx, %ecx
movl %ecx, %esi
leaq 0x9547(%rip), %rcx      # 0x192f2
cmpl $0x0, %edx
cmovgq %rcx, %rsi
leaq 0x25a57(%rip), %rdi     # 0x35810
callq *%rax
jmp 0xfdbd
jmp 0xfde0
leaq 0xe7ed(%rip), %rdi      # 0x1e5b3
leaq 0xe66b(%rip), %rsi      # 0x1e438
movl $0x268, %edx            # imm = 0x268
leaq 0x25a37(%rip), %rcx     # 0x35810
movb $0x0, %al
callq 0x117c0
jmp 0xfde2
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
movb $0x0, 0x259dd(%rip)     # 0x35810
movl $0x0, 0x25ad3(%rip)     # 0x35910
movq $0x0, 0x25ad0(%rip) # 0x35918
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rax
addq %rax, %rdi
callq 0xf3f0
cmpl $-0x1, %eax
jne 0xfe84
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffa5
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0xf0b0
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jne 0xfee8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffa5
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
jmp 0xff9f
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
jmp 0xff9f
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
addq %rax, %rsi
movl -0x28(%rbp), %edx
callq 0xf790
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop