// File: /workspace/github_c_makefile_star2_O0/mabdi[P]bunney/bunny-gcc.c
// Function: compile
static void compile(void) { 
  _u8 *gcc = getenv("BUNNY_GCC");
  _u32 i;
  _u8 fname[128];
    
  if (!gcc) gcc = "/usr/bin/gcc";
  
  switch (gcc_mode) {
  
    case 'c':
      if (output_file) {
        debug("[bunny] STAGE 3/3: Compiling binary to '%s'...\n",output_file);
      } else {      
        debug("[bunny] STAGE 3/3: Compiling binary to default .o file(s)...\n");
      }
      break;
         
    case 'S':
      if (output_file) {
        debug("[bunny] STAGE 3/3: Compiling assembly code to '%s'...\n",output_file);
      } else {
        debug("[bunny] STAGE 3/3: Compiling assembly code to default .s file(s)...\n");
      }
      break;
      
    default:
      if (output_file) {
        debug("[bunny] STAGE 3/3: Compiling and linking executable to '%s'...\n",output_file);
      } else {
        debug("[bunny] STAGE 3/3: Compiling and linking executable to default location...\n");
      }
      break;
      
  }
  
  wait_execvp(gcc,compile_params.v);
  
  /* Us succeed? That's unpossible. */

  for (i=0;i<used_files.c;i++) {
    sprintf(fname,".bunny-%x-%u-f.i",mypid,i);
    if (!getenv("BUNNY_KEEPTEMP")) unlink(fname);
  }    
  
  /* We have to remove .o files to their ultimate destinations if no 'o' flag was found
     (if one was used, rename() will fail silently). */
  if (gcc_mode == 'c' || gcc_mode == 'S') 
    for (i=0;i<used_files.c;i++) {
      _u8 tmp[MAXTOKEN + 2], *per;
      if (gcc_mode == 'c') sprintf(fname,".bunny-%x-%u-f.o",mypid,i);
        else sprintf(fname,".bunny-%x-%u-f.s",mypid,i);
      
      tmp[MAXTOKEN-1] = 0;
      per = strrchr(used_files.v[i],'/');
      if (!per) per = used_files.v[i]; else per++;
      strncpy(tmp,per,MAXTOKEN-1);
      
      per = strrchr(tmp,'.');
      if (per) *per = 0;
      
      if (gcc_mode == 'c') strcat(tmp,".o"); else strcat(tmp,".s");
      
      rename(fname,tmp);
      
    }    
  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10b0, %rsp           # imm = 0x10B0
leaq 0x1c26(%rip), %rdi      # 0x7368
callq 0x11a0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x575d
leaq 0x1c19(%rip), %rax      # 0x7372
movq %rax, -0x8(%rbp)
movzbl 0x59f0(%rip), %eax      # 0xb154
movl %eax, -0x10ac(%rbp)
subl $0x53, %eax
je 0x57ca
jmp 0x5771
movl -0x10ac(%rbp), %eax
subl $0x63, %eax
jne 0x580f
jmp 0x5782
cmpq $0x0, 0x59ee(%rip)      # 0xb178
je 0x57ad
movq 0x584d(%rip), %rax      # 0xafe0
movq (%rax), %rdi
movq 0x59db(%rip), %rdx      # 0xb178
leaq 0x352d(%rip), %rsi      # 0x8cd1
movb $0x0, %al
callq 0x11c0
jmp 0x57c5
movq 0x582c(%rip), %rax      # 0xafe0
movq (%rax), %rdi
leaq 0x3543(%rip), %rsi      # 0x8d01
movb $0x0, %al
callq 0x11c0
jmp 0x5854
cmpq $0x0, 0x59a6(%rip)      # 0xb178
je 0x57f5
movq 0x5805(%rip), %rax      # 0xafe0
movq (%rax), %rdi
movq 0x5993(%rip), %rdx      # 0xb178
leaq 0x3553(%rip), %rsi      # 0x8d3f
movb $0x0, %al
callq 0x11c0
jmp 0x580d
movq 0x57e4(%rip), %rax      # 0xafe0
movq (%rax), %rdi
leaq 0x3570(%rip), %rsi      # 0x8d76
movb $0x0, %al
callq 0x11c0
jmp 0x5854
cmpq $0x0, 0x5961(%rip)      # 0xb178
je 0x583a
movq 0x57c0(%rip), %rax      # 0xafe0
movq (%rax), %rdi
movq 0x594e(%rip), %rdx      # 0xb178
leaq 0x358a(%rip), %rsi      # 0x8dbb
movb $0x0, %al
callq 0x11c0
jmp 0x5852
movq 0x579f(%rip), %rax      # 0xafe0
movq (%rax), %rdi
leaq 0x35b0(%rip), %rsi      # 0x8dfb
movb $0x0, %al
callq 0x11c0
jmp 0x5854
movq -0x8(%rbp), %rdi
movq 0x5909(%rip), %rsi      # 0xb168
callq 0x5a40
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x5914(%rip), %eax      # 0xb188
jae 0x58bf
leaq -0x90(%rbp), %rdi
movl 0x58cd(%rip), %edx      # 0xb150
movl -0xc(%rbp), %ecx
leaq 0x1a58(%rip), %rsi      # 0x72e5
movb $0x0, %al
callq 0x1040
leaq 0x1c76(%rip), %rdi      # 0x7511
callq 0x11a0
cmpq $0x0, %rax
jne 0x58b2
leaq -0x90(%rbp), %rdi
callq 0x1090
jmp 0x58b4
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x586b
movzbl 0x588e(%rip), %eax      # 0xb154
cmpl $0x63, %eax
je 0x58db
movzbl 0x5882(%rip), %eax      # 0xb154
cmpl $0x53, %eax
jne 0x5a2f
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x589d(%rip), %eax      # 0xb188
jae 0x5a2d
movzbl 0x585c(%rip), %eax      # 0xb154
cmpl $0x63, %eax
jne 0x591d
leaq -0x90(%rbp), %rdi
movl 0x5846(%rip), %edx      # 0xb150
movl -0xc(%rbp), %ecx
leaq 0x3533(%rip), %rsi      # 0x8e47
movb $0x0, %al
callq 0x1040
jmp 0x593b
leaq -0x90(%rbp), %rdi
movl 0x5826(%rip), %edx      # 0xb150
movl -0xc(%rbp), %ecx
leaq 0x3524(%rip), %rsi      # 0x8e58
movb $0x0, %al
callq 0x1040
movb $0x0, -0xa1(%rbp)
movq 0x5837(%rip), %rax      # 0xb180
movl -0xc(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
movl $0x2f, %esi
callq 0x1160
movq %rax, -0x10a8(%rbp)
cmpq $0x0, -0x10a8(%rbp)
jne 0x5982
movq 0x580e(%rip), %rax      # 0xb180
movl -0xc(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x10a8(%rbp)
jmp 0x5994
movq -0x10a8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10a8(%rbp)
leaq -0x10a0(%rbp), %rdi
movq -0x10a8(%rbp), %rsi
movl $0xfff, %edx            # imm = 0xFFF
callq 0x10b0
leaq -0x10a0(%rbp), %rdi
movl $0x2e, %esi
callq 0x1160
movq %rax, -0x10a8(%rbp)
cmpq $0x0, -0x10a8(%rbp)
je 0x59d8
movq -0x10a8(%rbp), %rax
movb $0x0, (%rax)
movzbl 0x5775(%rip), %eax      # 0xb154
cmpl $0x63, %eax
jne 0x59f9
leaq -0x10a0(%rbp), %rdi
leaq 0x3463(%rip), %rsi      # 0x8e55
callq 0x1210
jmp 0x5a0c
leaq -0x10a0(%rbp), %rdi
leaq 0x345f(%rip), %rsi      # 0x8e66
callq 0x1210
leaq -0x90(%rbp), %rdi
leaq -0x10a0(%rbp), %rsi
callq 0x10d0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x58e2
jmp 0x5a2f
addq $0x10b0, %rsp           # imm = 0x10B0
popq %rbp
retq
nopl (%rax,%rax)