// File: /workspace/github_c_makefile_star2_O3/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 0xaace(%rip), %rdx      # 0x5b157
xorl %ecx, %ecx
callq 0xee68
movq %rax, %r13
leaq 0xaac5(%rip), %rdx      # 0x5b15f
movss 0x4bc2(%rip), %xmm0     # 0x55264
movl %ebx, %edi
movq %r12, %rsi
callq 0xedb7
movss %xmm0, 0x4(%rsp)
leaq 0xac56(%rip), %rdx      # 0x5b30f
movl %ebx, %edi
movq %r12, %rsi
movss 0x4b9e(%rip), %xmm0     # 0x55264
callq 0xedb7
movss %xmm0, (%rsp)
leaq 0x9b68(%rip), %rdx      # 0x5a23f
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xed18
movl %eax, %ebp
leaq 0xaa7b(%rip), %rdx      # 0x5b167
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xed18
movl %eax, %r14d
leaq 0xaa68(%rip), %rdx      # 0x5b16a
movl %ebx, %edi
movq %r12, %rsi
movl $0x3, %ecx
callq 0xed18
cmpl $0x3, %ebx
jle 0x509c2
movq %rax, 0x40(%rsp)
movl %ebp, 0x1c(%rsp)
movq %r14, 0x48(%rsp)
leaq 0xa2e5(%rip), %rdx      # 0x5aa14
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xee68
movq %rax, %r14
leaq 0xabd0(%rip), %rdx      # 0x5b315
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xee68
movq %rax, 0x10(%rsp)
testq %r14, %r14
je 0x507a2
movq %r14, %rdi
callq 0x30b0
movq %r14, %rdi
callq 0x3140
movl $0x1, %ecx
movl $0x1, %ebp
testl %eax, %eax
jle 0x50795
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
xorl %esi, %esi
cmpb $0x2c, (%r14,%rdx)
sete %sil
addl %esi, %ebp
incq %rdx
cmpq %rdx, %rax
jne 0x50780
cmpl $0x2, %ebp
cmovgel %ebp, %ecx
decq %rcx
jne 0x5079b
jmp 0x507a7
movl $0x1, %ebp
leaq 0x99a7(%rip), %rdx      # 0x5a155
movl %ebx, %edi
movq %r12, %rsi
callq 0xeca2
movl %eax, %r15d
leaq 0xab58(%rip), %rdx      # 0x5b31a
movl %ebx, %edi
movq %r12, %rsi
callq 0xeca2
movq %rax, 0x38(%rsp)
leaq 0xab4e(%rip), %rdx      # 0x5b326
xorl %r14d, %r14d
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xed18
movq %rax, 0x30(%rsp)
leaq 0xab36(%rip), %rdx      # 0x5b329
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xed18
movq %rax, 0x28(%rsp)
leaq 0xab21(%rip), %rdx      # 0x5b32c
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xed18
cmpl $0x6, %ebx
movq %r13, 0x50(%rsp)
movq %rax, 0x20(%rsp)
jl 0x5082d
movq 0x28(%r12), %r14
jne 0x50838
movq $0x0, 0x8(%rsp)
jmp 0x50842
movq 0x30(%r12), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%r12), %rbx
movq 0x20(%r12), %r13
movq 0x10(%r12), %r12
leaq 0xa9fd(%rip), %rsi      # 0x5b255
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x5096f
leaq 0x9ba5(%rip), %rsi      # 0x5a414
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x509a0
leaq 0x77de(%rip), %rsi      # 0x58064
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x509d9
leaq 0xaa94(%rip), %rsi      # 0x5b331
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x509fa
leaq 0xa8bb(%rip), %rsi      # 0x5b16f
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
je 0x50a1b
leaq 0xa4f5(%rip), %rsi      # 0x5adc0
movq %r12, %rdi
callq 0x3260
testl %eax, %eax
jne 0x509ca
movq %rbx, %rdi
callq 0x36cb4
movq %rax, %rbx
leaq 0x89ae(%rip), %rsi      # 0x5929b
movq %rax, %rdi
movl $0x14, %edx
callq 0x36eed
movl %eax, %ebp
leaq 0x8ee6(%rip), %rsi      # 0x597e9
leaq 0xa9a2(%rip), %rdx      # 0x5b2ac
movq %rbx, %rdi
callq 0x36e77
movq %rax, %rdi
callq 0x2d26c
subq $0x8, %rsp
movq %r13, %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 0x81b0
addq $0x98, %rsp
jmp 0x509ce
movq %rbx, %rdi
movq %r13, %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 0x503f0
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movl %ebp, %r8d
movl %r15d, %r9d
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f7b0
movq %r12, %rdi
callq 0xe021
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd38d
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xca61
movq %r13, %rdi
movq %r14, %rsi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdc0f