// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/ripmime.c
// Function: RIPMIME_unpack
int RIPMIME_unpack( struct RIPMIME_globals *glb )
{
   struct stat st;
   int stat_result = 0;
   int result = 0;
   int input_is_directory = 0;

   /** If we're not inputting from STDIN, check to see if the
     ** input is a directory **/
   if (strcmp(glb->inputfile,"-")!=0) {
       stat_result = stat(glb->inputfile, &st);
       if (stat_result != 0) return -1;

       if (S_ISDIR(st.st_mode)) input_is_directory = 1;
   }

   if (input_is_directory == 1) {
       /** Unpack all files in directory **/
       DIR *dir;
       struct dirent *dir_entry;

       fprintf(stderr,"input file is a directory, recursing\n");
       dir = opendir(glb->inputfile);
       if (dir == NULL) return -1;

       do {
           /** Check every entry in the directory provided and if it's a file
             ** try to unpack it **/
           char fullfilename[1024];

           dir_entry = readdir( dir );
           if (dir_entry == NULL) break;

           if (strcmp(dir_entry->d_name, ".")==0) continue;
           if (strcmp(dir_entry->d_name, "..")==0) continue;

           snprintf(fullfilename,sizeof(fullfilename),"%s/%s", glb->inputfile, dir_entry->d_name);
           stat_result = stat( fullfilename, &st );
           if (stat_result != 0) continue;
           if (S_ISREG(st.st_mode)) {
               /** If the directory entry is a file, then unpack it **/
               fprintf(stdout,"Unpacking mailpack %s\n",fullfilename);
               result = RIPMIME_unpack_single(glb, fullfilename);
           }
       } while (dir_entry != NULL); /** While more files in the directory **/

       closedir( dir );

   } else {
       /** If the supplied file was actually a normal file, then decode normally **/
       result = RIPMIME_unpack_single( glb, glb->inputfile );
   }
   return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4c0, %rsp            # imm = 0x4C0
movq %rdi, -0x10(%rbp)
movl $0x0, -0xa4(%rbp)
movl $0x0, -0xa8(%rbp)
movl $0x0, -0xac(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x1918a(%rip), %rsi     # 0x1c525
callq 0x21e0
cmpl $0x0, %eax
je 0x33f1
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2230
movl %eax, -0xa4(%rbp)
cmpl $0x0, -0xa4(%rbp)
je 0x33d3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3579
movl -0x88(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x33ef
movl $0x1, -0xac(%rbp)
jmp 0x33f1
cmpl $0x1, -0xac(%rbp)
jne 0x355a
movq 0x22bf3(%rip), %rax     # 0x25ff8
movq (%rax), %rdi
leaq 0x160c7(%rip), %rsi     # 0x194d6
movb $0x0, %al
callq 0x2200
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x20f0
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0xb8(%rbp)
jne 0x343f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3579
jmp 0x3441
movq -0xb8(%rbp), %rdi
callq 0x2270
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
jne 0x3463
jmp 0x354c
movq -0xc0(%rbp), %rdi
addq $0x13, %rdi
leaq 0x179a8(%rip), %rsi     # 0x1ae1d
callq 0x21e0
cmpl $0x0, %eax
jne 0x3484
jmp 0x353e
movq -0xc0(%rbp), %rdi
addq $0x13, %rdi
leaq 0x17986(%rip), %rsi     # 0x1ae1c
callq 0x21e0
cmpl $0x0, %eax
jne 0x34a5
jmp 0x353e
leaq -0x4c0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0xc0(%rbp), %r8
addq $0x13, %r8
movl $0x400, %esi            # imm = 0x400
leaq 0x16032(%rip), %rdx     # 0x194fc
movb $0x0, %al
callq 0x2130
leaq -0x4c0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2230
movl %eax, -0xa4(%rbp)
cmpl $0x0, -0xa4(%rbp)
je 0x34f5
jmp 0x353e
movl -0x88(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x353c
movq 0x22ac2(%rip), %rax     # 0x25fd0
movq (%rax), %rdi
leaq -0x4c0(%rbp), %rdx
leaq 0x15fe3(%rip), %rsi     # 0x19502
movb $0x0, %al
callq 0x2200
movq -0x10(%rbp), %rdi
leaq -0x4c0(%rbp), %rsi
callq 0x32f0
movl %eax, -0xa8(%rbp)
jmp 0x353e
cmpq $0x0, -0xc0(%rbp)
jne 0x3441
movq -0xb8(%rbp), %rdi
callq 0x2190
jmp 0x3570
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x32f0
movl %eax, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x4c0, %rsp            # imm = 0x4C0
popq %rbp
retq
nopw %cs:(%rax,%rax)