// File: /workspace/github_c_makefile_star2_O0/Cloudef[P]dwm-fork/dwm.c
// Function: spawn
void
spawn(const Arg *arg) {
   pid_t pid;

   if((pid = fork()) != 0)
      return;
   if(dpy)
      close(ConnectionNumber(dpy));

   /* open new programs in same working directory
    * as focused application */
   if (selmon->sel)
   {
         const char *home = getenv("HOME");
         assert(home && strchr(home, '/'));
         const size_t homelen= strlen(home);
         char *cwd, *pathbuf = NULL;
         struct stat statbuf;
         int check_again = 0;

         /* Check first if the whole thing is a path */
         cwd = selmon->sel->name;
         if (*cwd == '~') { /* expand to $HOME */
            if(!(pathbuf = malloc(homelen + strlen(cwd))))
               die("fatal: you are out of memory dummy!\n");
            strcpy(strcpy(pathbuf, home) + homelen, cwd + 1);
            cwd = pathbuf;
         }

         if (strchr(cwd, '/') && !stat(cwd, &statbuf))
         {
            if (!S_ISDIR(statbuf.st_mode))
               cwd = dirname(cwd);

            if (!chdir(cwd))
               check_again = 1;
         }
         if (pathbuf) free(pathbuf);
         pathbuf = NULL;

         if (!check_again)
         {
            /* NOTE: this needs the application to show path
             * in it's name */
            cwd = strtok(selmon->sel->name, SPAWN_CWD_DELIM);
            while (cwd) {
               if (*cwd == '~') { /* expand to $HOME */
                  if(!(pathbuf = malloc(homelen + strlen(cwd))))
                     die("fatal: you are out of memory dummy!\n");
                  strcpy(strcpy(pathbuf, home) + homelen, cwd + 1);
                  cwd = pathbuf;
               }

               if (strchr(cwd, '/') && !stat(cwd, &statbuf))
               {
                  if (!S_ISDIR(statbuf.st_mode))
                     cwd = dirname(cwd);

                  if (!chdir(cwd))
                     break;
               }

               cwd = strtok(NULL, SPAWN_CWD_DELIM);
            }
         }

         /* our memory shall be gone */
         if (pathbuf) free(pathbuf);
         pathbuf = NULL;
   }

   setsid();
   freopen("/dev/null", "w", stdout); freopen("/dev/null", "w", stderr);
   execvp(((char **)arg->v)[0], (char **)arg->v);
   fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
   perror(" failed");
   _exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
callq 0x56b0
movl %eax, -0xc(%rbp)
cmpl $0x0, %eax
je 0xa3d5
addq $0xe0, %rsp
popq %rbp
retq
cmpq $0x0, 0xe23b(%rip)      # 0x18618
je 0xa3ee
movq 0xe232(%rip), %rax      # 0x18618
movl 0x10(%rax), %edi
callq 0x50d0
movq 0xe20b(%rip), %rax      # 0x18600
cmpq $0x0, 0x80(%rax)
je 0xa69d
leaq 0x8d3c(%rip), %rdi      # 0x13146
callq 0x5490
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xa430
movq -0x18(%rbp), %rdi
movl $0x2f, %esi
callq 0x5460
cmpq $0x0, %rax
je 0xa430
jmp 0xa44f
leaq 0x81ee(%rip), %rdi      # 0x12625
leaq 0x8201(%rip), %rsi      # 0x1263f
movl $0xab5, %edx            # imm = 0xAB5
leaq 0x81fb(%rip), %rcx      # 0x12645
callq 0x5150
movq -0x18(%rbp), %rdi
callq 0x52d0
movq %rax, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0xc4(%rbp)
movq 0xe18b(%rip), %rax      # 0x18600
movq 0x80(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7e, %eax
jne 0xa4f0
movq -0x20(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x28(%rbp), %rdi
callq 0x52d0
movq -0xd0(%rbp), %rdi
addq %rax, %rdi
callq 0x51e0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xa4c7
leaq 0x819d(%rip), %rdi      # 0x1265d
movb $0x0, %al
callq 0x5ab0
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5560
movq %rax, %rdi
addq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x1, %rsi
callq 0x5560
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movl $0x2f, %esi
callq 0x5460
cmpq $0x0, %rax
je 0xa552
movq -0x28(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x5750
cmpl $0x0, %eax
jne 0xa552
movl -0xa8(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x4000, %eax           # imm = 0x4000
je 0xa538
movq -0x28(%rbp), %rdi
callq 0x5050
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x5040
cmpl $0x0, %eax
jne 0xa550
movl $0x1, -0xc4(%rbp)
jmp 0xa552
cmpq $0x0, -0x30(%rbp)
je 0xa562
movq -0x30(%rbp), %rdi
callq 0x52b0
movq $0x0, -0x30(%rbp)
cmpl $0x0, -0xc4(%rbp)
jne 0xa685
movq 0xe082(%rip), %rax      # 0x18600
movq 0x80(%rax), %rdi
leaq 0x80f6(%rip), %rsi      # 0x12682
callq 0x5570
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xa683
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7e, %eax
jne 0xa610
movq -0x20(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x28(%rbp), %rdi
callq 0x52d0
movq -0xd8(%rbp), %rdi
addq %rax, %rdi
callq 0x51e0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xa5e7
leaq 0x807d(%rip), %rdi      # 0x1265d
movb $0x0, %al
callq 0x5ab0
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5560
movq %rax, %rdi
addq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x1, %rsi
callq 0x5560
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movl $0x2f, %esi
callq 0x5460
cmpq $0x0, %rax
je 0xa66a
movq -0x28(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x5750
cmpl $0x0, %eax
jne 0xa66a
movl -0xa8(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x4000, %eax           # imm = 0x4000
je 0xa658
movq -0x28(%rbp), %rdi
callq 0x5050
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x5040
cmpl $0x0, %eax
jne 0xa668
jmp 0xa683
jmp 0xa66a
xorl %eax, %eax
movl %eax, %edi
leaq 0x800d(%rip), %rsi      # 0x12682
callq 0x5570
movq %rax, -0x28(%rbp)
jmp 0xa595
jmp 0xa685
cmpq $0x0, -0x30(%rbp)
je 0xa695
movq -0x30(%rbp), %rdi
callq 0x52b0
movq $0x0, -0x30(%rbp)
callq 0x50c0
movq 0xc94f(%rip), %rax      # 0x16ff8
movq (%rax), %rdx
leaq 0x7fdd(%rip), %rdi      # 0x12690
leaq 0x7fe0(%rip), %rsi      # 0x1269a
callq 0x5610
movq 0xc922(%rip), %rax      # 0x16fe8
movq (%rax), %rdx
leaq 0x7fc0(%rip), %rdi      # 0x12690
leaq 0x7fc3(%rip), %rsi      # 0x1269a
callq 0x5610
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
callq 0x5130
movq 0xc8ef(%rip), %rax      # 0x16fe8
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdx
leaq 0x7f8f(%rip), %rsi      # 0x1269c
movb $0x0, %al
callq 0x5740
leaq 0x7f90(%rip), %rdi      # 0x126ab
callq 0x5700
xorl %edi, %edi
callq 0x5220
nopw (%rax,%rax)