// File: /workspace/github_c_makefile_star2_O1/inflex[P]ripMIME/tnef/tnef.c
// Function: handle_props
int handle_props(uint8 *tsp)
{
	int bytes = 0;
	uint32 num_props = 0;
	uint32 x = 0;


	RT32(&num_props, tsp);
	bytes += sizeof(num_props);

	while (x < num_props)
	{
		uint32 prop_tag;
		uint32 num;
		char filename[256];

		RT32(&prop_tag, tsp+bytes);
		bytes += sizeof(prop_tag);

		switch (prop_tag & PROP_TYPE_MASK)
		{
			case PT_BINARY:
				RT32(&num, tsp+bytes);
				bytes += sizeof(num);
				RT32(&num, tsp+bytes);
				bytes += sizeof(num);
				if (prop_tag == PR_RTF_COMPRESSED)
				{
					sprintf (filename, "XAM_%d.rtf", TNEF_glb.file_num);
					TNEF_glb.file_num++;
					save_attach_data(filename, tsp+bytes, num);
				}
				/* num + PAD */
				bytes += num + ((num % 4) ? (4 - num%4) : 0);
				break;
			case PT_STRING8:
				RT32(&num, tsp+bytes);
				bytes += sizeof(num);
				RT32(&num, tsp+bytes);
				bytes += sizeof(num);
				make_string(tsp+bytes,num);
				bytes += num + ((num % 4) ? (4 - num%4) : 0);
				break;
			case PT_UNICODE:
			case PT_OBJECT:
				break;
			case PT_I2:
				bytes += 2;
				break;
			case PT_LONG:
				bytes += 4;
				break;
			case PT_R4:
				bytes += 4;
				break;
			case PT_DOUBLE:
				bytes += 8;
				break;
			case PT_CURRENCY:
			case PT_APPTIME:
			case PT_ERROR:
				bytes += 4;
				break;
			case PT_BOOLEAN:
				bytes += 4;
				break;
			case PT_I8:
				bytes += 8;
			case PT_SYSTIME:
				bytes += 8;
				break;
		}
		x++;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
leaq 0xc(%rsp), %rdi
movl $0x0, (%rdi)
movq %rbx, %rsi
callq 0xb3a2
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0xb73d
movl $0x4, %ebp
movl 0xc(%rsp), %eax
movl %eax, 0x4(%rsp)
movq %rsp, %r14
xorl %r15d, %r15d
cmpl 0x4(%rsp), %r15d
jae 0xb734
movslq %ebp, %rsi
addq %rbx, %rsi
leaq 0x8(%rsp), %rdi
callq 0xb3a2
cmpl $-0x1, %eax
je 0xb5b7
movq %r14, %r13
leal 0x4(%rbp), %r12d
movl 0x8(%rsp), %r14d
movzwl %r14w, %eax
cmpl $0x1d, %eax
jg 0xb5c2
addl $-0x2, %eax
cmpl $0x12, %eax
ja 0xb6f8
leaq 0xbce5(%rip), %rcx      # 0x17280
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %r13, %r14
jmpq *%rax
addl $0x8, %ebp
movl %ebp, %r12d
incl %r15d
movb $0x1, %al
movl %r12d, %ebp
jmp 0xb5b9
xorl %eax, %eax
testb %al, %al
jne 0xb553
jmp 0xb738
cmpl $0x1e, %eax
je 0xb68b
cmpl $0x40, %eax
je 0xb700
cmpl $0x102, %eax            # imm = 0x102
jne 0xb6f8
movslq %r12d, %rsi
addq %rbx, %rsi
movq %r13, %rdi
callq 0xb3a2
cmpl $-0x1, %eax
je 0xb713
leal 0x8(%rbp), %r12d
movslq %r12d, %rsi
addq %rbx, %rsi
movq %rsp, %rdi
callq 0xb3a2
cmpl $-0x1, %eax
je 0xb727
addl $0xc, %ebp
cmpl $0x10090102, %r14d      # imm = 0x10090102
jne 0xb650
movl 0x238bd(%rip), %edx     # 0x2eee0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
leaq 0xbd6c(%rip), %rsi      # 0x1739e
xorl %eax, %eax
callq 0x2370
incl 0x238a1(%rip)           # 0x2eee0
movslq %ebp, %rsi
addq %rbx, %rsi
movl (%rsp), %edx
movq %r14, %rdi
callq 0xb460
movl (%rsp), %eax
movl %eax, %ecx
andl $0x3, %ecx
movl $0x4, %edx
subl %ecx, %edx
testl %ecx, %ecx
cmovel %ecx, %edx
addl %eax, %ebp
addl %edx, %ebp
movl %ebp, %r12d
jmp 0xb6f8
addl $0x6, %ebp
jmp 0xb5aa
addl $0xc, %ebp
movl %ebp, %r12d
jmp 0xb703
addl $0xc, %ebp
jmp 0xb5aa
movslq %r12d, %rsi
addq %rbx, %rsi
movq %r13, %r14
movq %r13, %rdi
callq 0xb3a2
cmpl $-0x1, %eax
je 0xb70c
movq %r14, %rdi
leal 0x8(%rbp), %r14d
movslq %r14d, %rsi
addq %rbx, %rsi
callq 0xb3a2
cmpl $-0x1, %eax
je 0xb720
leal 0xc(%rbp), %eax
movslq %eax, %rcx
addq %rbx, %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x23c53(%rip), %rdi     # 0x2f320
leaq 0xc9b9(%rip), %rdx      # 0x1808d
xorl %eax, %eax
callq 0x2140
movl (%rsp), %eax
leal (%rax,%rbp), %r12d
addl $0xc, %r12d
andl $0x3, %eax
movl $0x4, %ecx
subl %eax, %ecx
testl %eax, %eax
cmovel %eax, %ecx
addl %ecx, %r12d
movq %r13, %r14
jmp 0xb5ad
movq %r13, %r14
addl $0x8, %r12d
jmp 0xb5ad
xorl %eax, %eax
jmp 0xb5b2
xorl %eax, %eax
movl %r12d, %ebp
movq %rsp, %r14
jmp 0xb5b9
xorl %eax, %eax
movl %r14d, %ebp
jmp 0xb72c
xorl %eax, %eax
movl %r12d, %ebp
movq %r13, %r14
jmp 0xb5b9
xorl %ecx, %ecx
jmp 0xb73d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq