// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/ripOLE/ripole.c
// Function: main
int main( int argc, char **argv )
{
	struct ripOLE_object role;
	struct OLE_object *ole = NULL;
	int result = 0;

	if (argc == 1) { fprintf (stdout, "%s\n", help); exit(1); }

	ole = malloc(sizeof(struct OLE_object));
	if (ole == NULL)
	{
		LOGGER_log("ripOLE: Cannot allocate memory for OLE object");
		return 1;
	}


	LOGGER_set_output_mode(_LOGGER_STDOUT);

	OLE_init(ole);
	ROLE_init(&role);

	ROLE_set_defaults( &role );
	ROLE_parse_parameters(&role, argc, argv);
	result = ROLE_validate(&role);
	if (result != 0) return result;

	ROLE_set_parameters(&role, ole);

	OLE_set_filename_report_fn(ole, ROLE_report_filename_decoded );

	result = OLE_decode_file( ole, role.inputfile, role.outputdir );
	OLE_decode_file_done(ole);

	if ((result != 0)) {
		if (role.verbose) {
			switch (result) {
				case OLEER_NO_INPUT_FILE:
				case OLEER_BAD_INPUT_FILE:
					LOGGER_log("Cannot locate input file '%s'",role.inputfile);
					break;
				case OLEER_NOT_OLE_FILE:
					LOGGER_log("File '%s' is not OLE2 format",role.inputfile);
					break;
				case OLEER_INSANE_OLE_FILE:
					LOGGER_log("OLE input file '%s' is insane", role.inputfile);
					break;
				default:
					LOGGER_log("ripOLE: decoding of %s resulted in error %d\n", role.inputfile, result );
			}
		}
		return result;
	}

	if (ole != NULL) free(ole);
	ROLE_done(&role);

	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
cmpl $0x1, %edi
je 0x49bf
movq %rsi, %rbx
movl %edi, %ebp
movl $0x478, %edi            # imm = 0x478
callq 0x1110
testq %rax, %rax
je 0x48d4
movq %rax, %r14
pushq $0x2
popq %rdi
callq 0x39ec
movq %r14, %rdi
callq 0x1320
leaq 0x5890(%rip), %rax      # 0xa130
leaq 0x8(%rsp), %r15
movq %rax, 0x18(%r15)
andq $0x0, (%r15)
andl $0x0, 0x8(%r15)
andq $0x0, 0x10(%r15)
movq %r15, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4603
movq %r15, %rdi
callq 0x4830
testl %eax, %eax
je 0x48f2
pushq $-0x1
jmp 0x48e4
leaq 0x275d(%rip), %rdi      # 0x7038
xorl %eax, %eax
callq 0x3bc1
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x47a6
leaq -0x11b(%rip), %rsi      # 0x47ee
movq %r14, %rdi
callq 0x2845
movq 0x10(%rbx), %r15
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2cec
movl %eax, %ebx
movq %r14, %rdi
callq 0x2974
testl %ebx, %ebx
je 0x4960
cmpl $0x0, 0xc(%rsp)
je 0x48e5
leal -0x64(%rbx), %eax
cmpl $0x2, %eax
jb 0x4979
cmpl $0x66, %ebx
je 0x498f
cmpl $0x67, %ebx
jne 0x49a7
leaq 0x274f(%rip), %rdi      # 0x70a1
movq %r15, %rsi
xorl %eax, %eax
callq 0x3bc1
pushq $0x67
jmp 0x48e4
movq %r14, %rdi
callq 0x1030
leaq 0x8(%rsp), %rdi
callq 0x4816
xorl %ebx, %ebx
jmp 0x48e5
leaq 0x26e6(%rip), %rdi      # 0x7066
movq %r15, %rsi
xorl %eax, %eax
callq 0x3bc1
jmp 0x48e5
leaq 0x26ee(%rip), %rdi      # 0x7084
movq %r15, %rsi
xorl %eax, %eax
callq 0x3bc1
pushq $0x66
jmp 0x48e4
leaq 0x2711(%rip), %rdi      # 0x70bf
movq %r15, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x3bc1
jmp 0x48e5
movq 0x560a(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
leaq 0x2626(%rip), %rsi      # 0x6ff6
leaq 0x57b9(%rip), %rdx      # 0xa190
xorl %eax, %eax
callq 0x10d0
pushq $0x1
popq %rdi
callq 0x1190