// File: /workspace/github_c_makefile_star2_O3/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 0x4c02
movq %rsi, %rbx
movl %edi, %ebp
movl $0x478, %edi            # imm = 0x478
callq 0x1110
testq %rax, %rax
je 0x4b7a
movq %rax, %r15
movl $0x2, %edi
callq 0x3a84
movq %r15, %rdi
callq 0x134c
leaq 0x5661(%rip), %rax      # 0xa130
leaq 0x8(%rsp), %r14
movq %rax, 0x18(%r14)
xorl %eax, %eax
movq %rax, (%r14)
movl $0x0, 0x8(%r14)
movq %rax, 0x10(%r14)
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4802
movq 0x10(%r14), %rbx
testq %rbx, %rbx
je 0x4be9
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x49ce
leaq -0xfe(%rip), %rsi       # 0x4a1c
movq %r15, %rdi
callq 0x28b9
movq 0x18(%r14), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2d7e
movl %eax, %r14d
movq %r15, %rdi
callq 0x29ec
testl %r14d, %r14d
je 0x4b90
cmpl $0x0, 0xc(%rsp)
je 0x4bf4
leal -0x64(%r14), %eax
cmpl $0x2, %eax
jb 0x4ba7
cmpl $0x66, %r14d
je 0x4bba
cmpl $0x67, %r14d
jne 0x4bd3
leaq 0x2539(%rip), %rdi      # 0x70a1
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3c5f
movl $0x67, %r14d
jmp 0x4bf4
leaq 0x24b7(%rip), %rdi      # 0x7038
xorl %eax, %eax
callq 0x3c5f
movl $0x1, %r14d
jmp 0x4bf4
movq %r15, %rdi
callq 0x1030
leaq 0x8(%rsp), %rdi
callq 0x4a4a
xorl %r14d, %r14d
jmp 0x4bf4
leaq 0x24b8(%rip), %rdi      # 0x7066
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3c5f
jmp 0x4bf4
leaq 0x24c3(%rip), %rdi      # 0x7084
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3c5f
movl $0x66, %r14d
jmp 0x4bf4
leaq 0x24e5(%rip), %rdi      # 0x70bf
movq %rbx, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x3c5f
jmp 0x4bf4
callq 0x1240
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x53c7(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
leaq 0x23e3(%rip), %rsi      # 0x6ff6
leaq 0x5576(%rip), %rdx      # 0xa190
xorl %eax, %eax
callq 0x10d0
movl $0x1, %edi
callq 0x1180