// File: /workspace/github_c_makefile_star2_O0/mabdi[P]bunney/bunny-main.c
// Function: start_flow
static void start_flow(void) {
  int toflow[2], fromflow[2];  
  _u32 fuzzable;
  
  if (pipe(toflow) || pipe(fromflow)) pfatal("unable to create a pipe");

  inflow_dir = strdup(N(out_dir,".flow-in"));
  point_inflow(in_dir);

  outflow_dir = strdup(N(out_dir,".flow-out"));
  if (!outflow_dir) fatal("out of memory");
  mkdir(outflow_dir,0755); /* Ignore errors */
  purge_outflow();
  
  flow_pid = fork();
  if (flow_pid < 0) pfatal("unable to create a child process");
  
  if (!flow_pid) {
    _u8  *logfile;
    _s32 fd;
    
    logfile = N(out_dir,"bunny-flow.out");
    
    unlink(logfile);
    fd = open(logfile,O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE,0600);
    if (fd >= 0) { dup2(fd, 2); close(fd); }
    
    if (dup2(toflow[0],0) < 0 || dup2(fromflow[1],1) < 0) pfatal("dup2() failed");
    close(toflow[0]); close(toflow[1]);
    close(fromflow[0]); close(fromflow[1]);

#ifdef USE_EXEC_CWD
    if (access("bunny-flow",X_OK))
#endif /* USE_EXEC_CWD */
      execlp("bunny-flow","bunny-flow",inflow_dir,outflow_dir, (char*) NULL);
#ifdef USE_EXEC_CWD
    else 
      execl("./bunny-flow","bunny-flow",inflow_dir,outflow_dir, (char*) NULL);
#endif /* USE_EXEC_CWD */

    pfatal("cannot execute bunny-flow");
    
  }
  
  flow_pipe_cmd  = toflow[1];  
  flow_pipe_ret  = fromflow[0];  
  
  close(toflow[0]);
  close(fromflow[1]);
  
  fuzzable = flow_command(FLOW_GET_FUZZABLE,0,0,0);    
  if (!size_limit) size_limit = 2*fuzzable;

  outf("[+] Flow controller launched, %u bytes fuzzable.\n",fuzzable);
  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq -0x8(%rbp), %rdi
callq 0x2290
cmpl $0x0, %eax
jne 0x59b8
leaq -0x10(%rbp), %rdi
callq 0x2290
cmpl $0x0, %eax
je 0x5a59
jmp 0x59ba
jmp 0x59bc
leaq 0x982d(%rip), %rdi      # 0xf1f0
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc906(%rip)      # 0x122d8
je 0x59e9
movq 0xc8fd(%rip), %rdi      # 0x122d8
leaq 0x980e(%rip), %rsi      # 0xf1f0
movb $0x0, %al
callq 0x22d0
jmp 0x59eb
jmp 0x59ed
leaq 0x87bd(%rip), %rdi      # 0xe1b1
leaq 0x9823(%rip), %rsi      # 0xf21e
leaq 0x87bf(%rip), %rdx      # 0xe1c1
movl $0x1ae, %ecx            # imm = 0x1AE
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc8c2(%rip)      # 0x122d8
je 0x5a41
movq 0xc8b9(%rip), %rdi      # 0x122d8
leaq 0x878b(%rip), %rsi      # 0xe1b1
leaq 0x97f1(%rip), %rdx      # 0xf21e
leaq 0x878d(%rip), %rcx      # 0xe1c1
movl $0x1ae, %r8d            # imm = 0x1AE
movb $0x0, %al
callq 0x22d0
jmp 0x5a43
leaq 0x9566(%rip), %rdi      # 0xefb0
callq 0x2190
movl $0x1, %edi
callq 0x2250
movq 0xc880(%rip), %rdi      # 0x122e0
leaq 0x8ccc(%rip), %rsi      # 0xe733
callq 0x7010
movq %rax, %rdi
callq 0x2380
movq %rax, 0xc8fd(%rip)      # 0x12378
movq 0xc84e(%rip), %rdi      # 0x122d0
callq 0x7130
movq 0xc852(%rip), %rdi      # 0x122e0
leaq 0x9794(%rip), %rsi      # 0xf229
callq 0x7010
movq %rax, %rdi
callq 0x2380
movq %rax, 0xc8d7(%rip)      # 0x12380
cmpq $0x0, 0xc8cf(%rip)      # 0x12380
jne 0x5b4c
jmp 0x5ab9
jmp 0x5abb
leaq 0x8a4a(%rip), %rdi      # 0xe50c
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc807(%rip)      # 0x122d8
je 0x5ae8
movq 0xc7fe(%rip), %rdi      # 0x122d8
leaq 0x8a2b(%rip), %rsi      # 0xe50c
movb $0x0, %al
callq 0x22d0
jmp 0x5aea
jmp 0x5aec
leaq 0x86be(%rip), %rdi      # 0xe1b1
leaq 0x9724(%rip), %rsi      # 0xf21e
leaq 0x86c0(%rip), %rdx      # 0xe1c1
movl $0x1b4, %ecx            # imm = 0x1B4
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc7c3(%rip)      # 0x122d8
je 0x5b40
movq 0xc7ba(%rip), %rdi      # 0x122d8
leaq 0x868c(%rip), %rsi      # 0xe1b1
leaq 0x96f2(%rip), %rdx      # 0xf21e
leaq 0x868e(%rip), %rcx      # 0xe1c1
movl $0x1b4, %r8d            # imm = 0x1B4
movb $0x0, %al
callq 0x22d0
jmp 0x5b42
movl $0x1, %edi
callq 0x2250
movq 0xc82d(%rip), %rdi      # 0x12380
movl $0x1ed, %esi            # imm = 0x1ED
callq 0x2100
callq 0x72e0
callq 0x2090
movl %eax, 0xc6c3(%rip)      # 0x12230
cmpl $0x0, 0xc6bc(%rip)      # 0x12230
jge 0x5c1b
jmp 0x5b7c
jmp 0x5b7e
leaq 0x96ae(%rip), %rdi      # 0xf233
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc744(%rip)      # 0x122d8
je 0x5bab
movq 0xc73b(%rip), %rdi      # 0x122d8
leaq 0x968f(%rip), %rsi      # 0xf233
movb $0x0, %al
callq 0x22d0
jmp 0x5bad
jmp 0x5baf
leaq 0x85fb(%rip), %rdi      # 0xe1b1
leaq 0x9661(%rip), %rsi      # 0xf21e
leaq 0x85fd(%rip), %rdx      # 0xe1c1
movl $0x1b9, %ecx            # imm = 0x1B9
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc700(%rip)      # 0x122d8
je 0x5c03
movq 0xc6f7(%rip), %rdi      # 0x122d8
leaq 0x85c9(%rip), %rsi      # 0xe1b1
leaq 0x962f(%rip), %rdx      # 0xf21e
leaq 0x85cb(%rip), %rcx      # 0xe1c1
movl $0x1b9, %r8d            # imm = 0x1B9
movb $0x0, %al
callq 0x22d0
jmp 0x5c05
leaq 0x93a4(%rip), %rdi      # 0xefb0
callq 0x2190
movl $0x1, %edi
callq 0x2250
cmpl $0x0, 0xc60e(%rip)      # 0x12230
jne 0x5e66
movq 0xc6b1(%rip), %rdi      # 0x122e0
leaq 0x9634(%rip), %rsi      # 0xf26a
callq 0x7010
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2110
movq -0x20(%rbp), %rdi
movl $0xc1, %esi
movl $0x180, %edx            # imm = 0x180
movb $0x0, %al
callq 0x2150
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x5c7b
movl -0x24(%rbp), %edi
movl $0x2, %esi
callq 0x21d0
movl -0x24(%rbp), %edi
callq 0x23a0
movl -0x8(%rbp), %edi
xorl %esi, %esi
callq 0x21d0
cmpl $0x0, %eax
jl 0x5ca0
movl -0xc(%rbp), %edi
movl $0x1, %esi
callq 0x21d0
cmpl $0x0, %eax
jge 0x5d41
jmp 0x5ca2
jmp 0x5ca4
leaq 0x95ce(%rip), %rdi      # 0xf279
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc61e(%rip)      # 0x122d8
je 0x5cd1
movq 0xc615(%rip), %rdi      # 0x122d8
leaq 0x95af(%rip), %rsi      # 0xf279
movb $0x0, %al
callq 0x22d0
jmp 0x5cd3
jmp 0x5cd5
leaq 0x84d5(%rip), %rdi      # 0xe1b1
leaq 0x953b(%rip), %rsi      # 0xf21e
leaq 0x84d7(%rip), %rdx      # 0xe1c1
movl $0x1c5, %ecx            # imm = 0x1C5
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc5da(%rip)      # 0x122d8
je 0x5d29
movq 0xc5d1(%rip), %rdi      # 0x122d8
leaq 0x84a3(%rip), %rsi      # 0xe1b1
leaq 0x9509(%rip), %rdx      # 0xf21e
leaq 0x84a5(%rip), %rcx      # 0xe1c1
movl $0x1c5, %r8d            # imm = 0x1C5
movb $0x0, %al
callq 0x22d0
jmp 0x5d2b
leaq 0x927e(%rip), %rdi      # 0xefb0
callq 0x2190
movl $0x1, %edi
callq 0x2250
movl -0x8(%rbp), %edi
callq 0x23a0
movl -0x4(%rbp), %edi
callq 0x23a0
movl -0x10(%rbp), %edi
callq 0x23a0
movl -0xc(%rbp), %edi
callq 0x23a0
leaq 0x9567(%rip), %rdi      # 0xf2cf
movl $0x1, %esi
callq 0x2370
cmpl $0x0, %eax
je 0x5d9d
movq 0xc5fa(%rip), %rdx      # 0x12378
movq 0xc5fb(%rip), %rcx      # 0x12380
leaq 0x9543(%rip), %rsi      # 0xf2cf
xorl %eax, %eax
movl %eax, %r8d
movq %rsi, %rdi
movb $0x0, %al
callq 0x20a0
jmp 0x5dc5
movq 0xc5d4(%rip), %rdx      # 0x12378
movq 0xc5d5(%rip), %rcx      # 0x12380
leaq 0x94eb(%rip), %rdi      # 0xf29d
leaq 0x9516(%rip), %rsi      # 0xf2cf
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x2270
jmp 0x5dc7
jmp 0x5dc9
leaq 0x94da(%rip), %rdi      # 0xf2aa
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc4f9(%rip)      # 0x122d8
je 0x5df6
movq 0xc4f0(%rip), %rdi      # 0x122d8
leaq 0x94bb(%rip), %rsi      # 0xf2aa
movb $0x0, %al
callq 0x22d0
jmp 0x5df8
jmp 0x5dfa
leaq 0x83b0(%rip), %rdi      # 0xe1b1
leaq 0x9416(%rip), %rsi      # 0xf21e
leaq 0x83b2(%rip), %rdx      # 0xe1c1
movl $0x1d2, %ecx            # imm = 0x1D2
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc4b5(%rip)      # 0x122d8
je 0x5e4e
movq 0xc4ac(%rip), %rdi      # 0x122d8
leaq 0x837e(%rip), %rsi      # 0xe1b1
leaq 0x93e4(%rip), %rdx      # 0xf21e
leaq 0x8380(%rip), %rcx      # 0xe1c1
movl $0x1d2, %r8d            # imm = 0x1D2
movb $0x0, %al
callq 0x22d0
jmp 0x5e50
leaq 0x9159(%rip), %rdi      # 0xefb0
callq 0x2190
movl $0x1, %edi
callq 0x2250
movl -0x4(%rbp), %eax
movl %eax, 0xc43d(%rip)      # 0x122ac
movl -0x10(%rbp), %eax
movl %eax, 0xc438(%rip)      # 0x122b0
movl -0x8(%rbp), %edi
callq 0x23a0
movl -0xc(%rbp), %edi
callq 0x23a0
movl $0x3, %edi
xorl %ecx, %ecx
movl %ecx, %esi
movl %ecx, %edx
callq 0x7590
movl %eax, -0x14(%rbp)
cmpl $0x0, 0xc466(%rip)      # 0x12308
jne 0x5eaf
movl -0x14(%rbp), %eax
shll %eax
movl %eax, 0xc459(%rip)      # 0x12308
jmp 0x5eb1
movl -0x14(%rbp), %esi
leaq 0x941f(%rip), %rdi      # 0xf2da
movb $0x0, %al
callq 0x2030
cmpq $0x0, 0xc40e(%rip)      # 0x122d8
je 0x5ee4
movq 0xc405(%rip), %rdi      # 0x122d8
movl -0x14(%rbp), %edx
leaq 0x93fd(%rip), %rsi      # 0xf2da
movb $0x0, %al
callq 0x22d0
jmp 0x5ee6
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)