// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/detector.c
// Function: run_detector
void run_detector(int argc, char **argv)
{
    char *prefix = find_char_arg(argc, argv, "-prefix", 0);
    float thresh = find_float_arg(argc, argv, "-thresh", .5);
    float hier_thresh = find_float_arg(argc, argv, "-hier", .5);
    int cam_index = find_int_arg(argc, argv, "-c", 0);
    int frame_skip = find_int_arg(argc, argv, "-s", 0);
    int avg = find_int_arg(argc, argv, "-avg", 3);
    if(argc < 4){
        fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
        return;
    }
    char *gpu_list = find_char_arg(argc, argv, "-gpus", 0);
    char *outfile = find_char_arg(argc, argv, "-out", 0);
    int *gpus = 0;
    int gpu = 0;
    int ngpus = 0;
    if(gpu_list){
        printf("%s\n", gpu_list);
        int len = strlen(gpu_list);
        ngpus = 1;
        int i;
        for(i = 0; i < len; ++i){
            if (gpu_list[i] == ',') ++ngpus;
        }
        gpus = calloc(ngpus, sizeof(int));
        for(i = 0; i < ngpus; ++i){
            gpus[i] = atoi(gpu_list);
            gpu_list = strchr(gpu_list, ',')+1;
        }
    } else {
        gpu = gpu_index;
        gpus = &gpu;
        ngpus = 1;
    }

    int clear = find_arg(argc, argv, "-clear");
    int fullscreen = find_arg(argc, argv, "-fullscreen");
    int width = find_int_arg(argc, argv, "-w", 0);
    int height = find_int_arg(argc, argv, "-h", 0);
    int fps = find_int_arg(argc, argv, "-fps", 0);
    //int class = find_int_arg(argc, argv, "-class", 0);

    char *datacfg = argv[3];
    char *cfg = argv[4];
    char *weights = (argc > 5) ? argv[5] : 0;
    char *filename = (argc > 6) ? argv[6]: 0;
    if(0==strcmp(argv[2], "test")) test_detector(datacfg, cfg, weights, filename, thresh, hier_thresh, outfile, fullscreen);
    else if(0==strcmp(argv[2], "train")) train_detector(datacfg, cfg, weights, gpus, ngpus, clear);
    else if(0==strcmp(argv[2], "valid")) validate_detector(datacfg, cfg, weights, outfile);
    else if(0==strcmp(argv[2], "valid2")) validate_detector_flip(datacfg, cfg, weights, outfile);
    else if(0==strcmp(argv[2], "recall")) validate_detector_recall(cfg, weights);
    else if(0==strcmp(argv[2], "demo")) {
        list *options = read_data_cfg(datacfg);
        int classes = option_find_int(options, "classes", 20);
        char *name_list = option_find_str(options, "names", "data/names.list");
        char **names = get_labels(name_list);
        demo(cfg, weights, thresh, cam_index, filename, names, classes, frame_skip, prefix, avg, hier_thresh, width, height, fps, fullscreen);
    }
    //else if(0==strcmp(argv[2], "extract")) extract_detector(datacfg, cfg, weights, cam_index, filename, class, thresh, frame_skip);
    //else if(0==strcmp(argv[2], "censor")) censor_detector(datacfg, cfg, weights, cam_index, filename, class, thresh, frame_skip);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r12
movl %edi, %ebx
leaq 0xa49a(%rip), %rdx      # 0x52017
xorl %ecx, %ecx
callq 0x4151
movq %rax, %r14
leaq 0xa491(%rip), %rdx      # 0x5201f
movss 0x469e(%rip), %xmm0     # 0x4c234
movl %ebx, %edi
movq %r12, %rsi
callq 0x40c0
movss %xmm0, 0x4(%rsp)
leaq 0xa622(%rip), %rdx      # 0x521cf
movl %ebx, %edi
movq %r12, %rsi
movss 0x467a(%rip), %xmm0     # 0x4c234
callq 0x40c0
movss %xmm0, (%rsp)
leaq 0x9574(%rip), %rdx      # 0x5113f
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x4041
movl %eax, %ebp
leaq 0xa447(%rip), %rdx      # 0x52027
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x4041
movl %eax, %r15d
leaq 0xa434(%rip), %rdx      # 0x5202a
pushq $0x3
popq %rcx
movl %ebx, %edi
movq %r12, %rsi
callq 0x4041
cmpl $0x3, %ebx
jle 0x47e5d
movq %rax, 0x40(%rsp)
movl %ebp, 0x1c(%rsp)
movq %r15, 0x48(%rsp)
movq %r14, 0x50(%rsp)
leaq 0x9ca6(%rip), %rdx      # 0x518cc
xorl %r15d, %r15d
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x4151
movq %rax, %r14
leaq 0xa596(%rip), %rdx      # 0x521d5
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x4151
movq %rax, 0x10(%rsp)
testq %r14, %r14
je 0x47c8e
movq %r14, %rdi
callq 0x30b0
movq %r14, %rdi
callq 0x3140
testl %eax, %eax
cmovlel %r15d, %eax
pushq $0x1
popq %rbp
cmpq %r15, %rax
je 0x47c84
xorl %ecx, %ecx
cmpb $0x2c, (%r14,%r15)
sete %cl
addl %ecx, %ebp
incq %r15
jmp 0x47c6e
movl %ebp, %eax
subq $0x1, %rax
jae 0x47c86
jmp 0x47c91
pushq $0x1
popq %rbp
leaq 0x93bd(%rip), %rdx      # 0x51055
movl %ebx, %edi
movq %r12, %rsi
callq 0x3fdd
movl %eax, %r13d
leaq 0xa52e(%rip), %rdx      # 0x521da
movl %ebx, %edi
movq %r12, %rsi
callq 0x3fdd
movl %eax, %r15d
leaq 0xa526(%rip), %rdx      # 0x521e6
xorl %r14d, %r14d
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x4041
movq %rax, 0x30(%rsp)
leaq 0xa50e(%rip), %rdx      # 0x521e9
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x4041
movq %rax, 0x28(%rsp)
leaq 0xa4f9(%rip), %rdx      # 0x521ec
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x4041
cmpl $0x6, %ebx
movq %r15, 0x38(%rsp)
movq %rax, 0x20(%rsp)
jl 0x47d15
movq 0x28(%r12), %r14
jne 0x47d20
movq $0x0, 0x8(%rsp)
jmp 0x47d2a
movq 0x30(%r12), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%r12), %rbx
movq 0x20(%r12), %r15
movq 0x10(%r12), %r12
leaq 0xa3d5(%rip), %rsi      # 0x52115
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x47dc8
leaq 0x95c1(%rip), %rsi      # 0x51314
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x47df9
leaq 0x721a(%rip), %rsi      # 0x4ef84
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x47e1b
leaq 0xa470(%rip), %rsi      # 0x521f1
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x47e3c
leaq 0xa297(%rip), %rsi      # 0x5202f
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x47e8c
leaq 0x9ed1(%rip), %rsi      # 0x51c80
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x47ea5
addq $0x58, %rsp
jmp 0x47f35
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq 0x8(%rsp), %rcx
movss 0x4(%rsp), %xmm0
movss (%rsp), %xmm1
movq 0x10(%rsp), %r8
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x478eb
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebp, %r8d
movl %r13d, %r9d
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x45800
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x46c99
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x461f0
movq 0x1c194(%rip), %rax     # 0x63ff8
movq (%rax), %rdi
movq (%r12), %rdx
movq 0x8(%r12), %rcx
leaq 0x9163(%rip), %rsi      # 0x50fda
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3270
movq %r15, %rdi
movq %r14, %rsi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x47508
movq %rbx, %rdi
callq 0x29598
movq %rax, %rbx
leaq 0x8334(%rip), %rsi      # 0x501eb
pushq $0x14
popq %rdx
movq %rax, %rdi
callq 0x2977d
movl %eax, %ebp
leaq 0x886e(%rip), %rsi      # 0x50739
leaq 0xa29a(%rip), %rdx      # 0x5216c
movq %rbx, %rdi
callq 0x29737
movq %rax, %rdi
callq 0x1e673
subq $0x8, %rsp
movq %r15, %rdi
movq %r14, %rsi
movss 0xc(%rsp), %xmm0
movl 0x24(%rsp), %edx
movq 0x10(%rsp), %rcx
movq %rax, %r8
movl %ebp, %r9d
movss 0x8(%rsp), %xmm1
pushq 0x40(%rsp)
pushq 0x30(%rsp)
pushq 0x40(%rsp)
pushq 0x50(%rsp)
pushq 0x68(%rsp)
pushq 0x80(%rsp)
pushq 0x80(%rsp)
callq 0x2faac
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq