// File: /workspace/github_c_makefile_star2_O1/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 0x4d28
movq %rsi, %rbx
movl %edi, %ebp
movl $0x478, %edi            # imm = 0x478
callq 0x1110
testq %rax, %rax
je 0x4cb5
movq %rax, %r15
movl $0x2, %edi
callq 0x3b6c
movq %r15, %rdi
callq 0x134c
leaq 0x8(%rsp), %r14
movl $0x0, (%r14)
xorl %eax, %eax
movq %rax, 0x4(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
leaq 0x54fb(%rip), %rcx      # 0xa130
movq %rcx, 0x18(%r14)
movq %rax, 0x10(%r14)
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x494e
movq 0x10(%r14), %r14
testq %r14, %r14
je 0x4d1c
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4b1a
leaq -0x106(%rip), %rsi      # 0x4b68
movq %r15, %rdi
callq 0x2951
movq 0x18(%rbx), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x2e1f
movl %eax, %ebx
movq %r15, %rdi
callq 0x2a8d
testl %ebx, %ebx
je 0x4cca
cmpl $0x0, 0xc(%rsp)
je 0x4cfa
leal -0x64(%rbx), %eax
cmpl $0x2, %eax
jb 0x4ce0
cmpl $0x66, %ebx
je 0x4ce9
cmpl $0x67, %ebx
jne 0x4d07
leaq 0x23ee(%rip), %rdi      # 0x70a1
jmp 0x4cf0
leaq 0x237c(%rip), %rdi      # 0x7038
xorl %eax, %eax
callq 0x3d40
movl $0x1, %ebx
jmp 0x4cfa
movq %r15, %rdi
callq 0x1030
leaq 0x8(%rsp), %rdi
callq 0x4b96
xorl %ebx, %ebx
jmp 0x4cfa
leaq 0x237f(%rip), %rdi      # 0x7066
jmp 0x4cf0
leaq 0x2394(%rip), %rdi      # 0x7084
movq %r14, %rsi
xorl %eax, %eax
callq 0x3d40
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x23b1(%rip), %rdi      # 0x70bf
movq %r14, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x3d40
jmp 0x4cfa
callq 0x1240
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x4cfa
movq 0x52a1(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
leaq 0x22bd(%rip), %rsi      # 0x6ff6
leaq 0x5450(%rip), %rdx      # 0xa190
xorl %eax, %eax
callq 0x10d0
movl $0x1, %edi
callq 0x1180