// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/ripmime.c
// Function: main
int main (int argc, char **argv)
{
   struct RIPMIME_globals glb;
   int result = 0;

   /* if the user has just typed in "ripmime" and nothing else, then we had better give them
    * the rundown on how to use this program */

   if (argc < 2)
   {
       fprintf (stderr, "%s\n%s", version, help);
       return RIPMIME_ERROR_INSUFFICIENT_PARAMETERS;
   }

   // Set the global pointer ripmime_globals to point to
   //      the glb struct, so that if we have a timeout condition
   //      we can use the data
   ripmime_globals = &glb;


   // Set up our initial logging mode - so that we can always get
   //              report messages if need be.

   LOGGER_set_output_mode (_LOGGER_STDOUT);

   // Perform system initialisations

   MIME_init ();
   RIPMIME_init (&glb);

   // Setup our default behaviours */

   MIME_set_uniquenames (1);
   MIME_set_paranoid (0);
   MIME_set_header_longsearch(1); // 20040310-0117:PLD - Added by default as it seems stable, use --disable-qmail-bounce to turn off
   MIME_set_renamemethod (_MIME_RENAME_METHOD_INFIX);


   RIPMIME_parse_parameters (&glb, argc, argv);


   // if our input filename wasn't specified, then we better let the user know!
   if (!glb.inputfile)
   {
       LOGGER_log("Error: No input file was specified\n");
       return RIPMIME_ERROR_NO_INPUT_FILE;
   }

   // Fire up the randomizer

   srand (time (NULL));

   // clean up the output directory name if required (remove any trailing /'s, as suggested by James Cownie 03/02/2001

   if (glb.dir[strlen (glb.dir) - 1] == '/')
   {
       glb.dir[strlen (glb.dir) - 1] = '\0';
   }

   // Create the output directory required as specified by the -d parameter

   if (glb.dir != defaultdir)
   {
       result = mkdir (glb.dir, S_IRWXU);

       // if we had a problem creating a directory, and it wasn't just
       // due to the directory already existing, then we have a bit of
       // a problem on our hands, hence, report it.
       //

       if ((result == -1) && (errno != EEXIST))
       {
           LOGGER_log("ripMIME: Cannot create directory '%s' (%s)\n",
                   glb.dir, strerror (errno));

           return RIPMIME_ERROR_CANT_CREATE_OUTPUT_DIR;
       }
   }

   // Unpack the contents
   result = RIPMIME_unpack(&glb);

   // Possible exit codes include;
   //      0 - all okay
   //      240 - processing stopped due to recursion limit
   if (glb.use_return_codes == 0) result = 0;
   return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
cmpl $0x1, %edi
jle 0x30d1
movq %rsi, %r14
movl %edi, %ebp
leaq 0x8(%rsp), %r15
movq %r15, 0x1cf0d(%rip)     # 0x1fed8
pushq $0x2
popq %rdi
callq 0xc0cc
callq 0x531c
leaq 0x1c231(%rip), %r12     # 0x1f210
movq %r12, 0x8(%r15)
andq $0x0, (%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15)
andl $0x0, 0x20(%r15)
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0x3539
xorl %edi, %edi
callq 0x3542
movl %ebx, %edi
callq 0x3444
movl %ebx, %edi
callq 0x355e
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x254c
cmpq $0x0, (%r15)
je 0x3091
xorl %edi, %edi
callq 0x2270
movl %eax, %edi
callq 0x21e0
movq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x2110
cmpb $0x2f, -0x1(%r14,%rax)
jne 0x3054
movb $0x0, -0x1(%r14,%rax)
movq 0x10(%rsp), %r14
cmpq %r12, %r14
je 0x3077
movq %r14, %rdi
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x20b0
cmpl $-0x1, %eax
jne 0x3077
callq 0x2060
movl (%rax), %edi
cmpl $0x11, %edi
jne 0x30b1
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2e4e
movl %eax, %ebx
movl 0x10(%r14), %eax
testl %eax, %eax
cmovel %eax, %ebx
jmp 0x30a2
leaq 0xe397(%rip), %rdi      # 0x1142f
xorl %eax, %eax
callq 0xc2a1
pushq $0x3
popq %rbx
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %r14
callq 0x23c0
leaq 0xe391(%rip), %rdi      # 0x11453
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0xc2a1
jmp 0x30a2
movq 0x1bf20(%rip), %rax     # 0x1eff8
movq (%rax), %rdi
leaq 0xe347(%rip), %rsi      # 0x11429
leaq 0x1c137(%rip), %rdx     # 0x1f220
leaq 0x1c180(%rip), %rcx     # 0x1f270
xorl %eax, %eax
callq 0x2210
pushq $0x4
jmp 0x30a1
nop