// File: /workspace/github_c_makefile_star2_O1/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, %r13d
leaq 0xabf5(%rip), %rdx      # 0x58fff
xorl %ecx, %ecx
callq 0xe64d
movq %rax, %rbx
leaq 0xabec(%rip), %rdx      # 0x59007
movss 0x4e11(%rip), %xmm0     # 0x53234
movl %r13d, %edi
movq %r12, %rsi
callq 0xe57a
movss %xmm0, 0x4(%rsp)
leaq 0xad7c(%rip), %rdx      # 0x591b7
movl %r13d, %edi
movq %r12, %rsi
movss 0x4deb(%rip), %xmm0     # 0x53234
callq 0xe57a
movss %xmm0, (%rsp)
leaq 0x9cad(%rip), %rdx      # 0x58107
movl %r13d, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xe4b3
movl %eax, %ebp
leaq 0xab9f(%rip), %rdx      # 0x5900f
movl %r13d, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xe4b3
movl %eax, %r14d
leaq 0xab8b(%rip), %rdx      # 0x59012
movl %r13d, %edi
movq %r12, %rsi
movl $0x3, %ecx
callq 0xe4b3
cmpl $0x3, %r13d
jle 0x4e756
movq %rax, 0x40(%rsp)
movl %ebp, 0x1c(%rsp)
movq %rbx, 0x50(%rsp)
leaq 0xa406(%rip), %rdx      # 0x588bc
movl %r13d, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xe64d
movq %rax, %rbx
leaq 0xacf0(%rip), %rdx      # 0x591bd
movl %r13d, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xe64d
movq %rax, 0x8(%rsp)
testq %rbx, %rbx
movq %r14, 0x48(%rsp)
je 0x4e52f
movq %rbx, %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x3150
movl $0x1, %ecx
movl $0x1, %ebp
testl %eax, %eax
jle 0x4e522
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
xorl %esi, %esi
cmpb $0x2c, (%rbx,%rdx)
sete %sil
addl %esi, %ebp
incq %rdx
cmpq %rdx, %rax
jne 0x4e50e
cmpl $0x2, %ebp
cmovgel %ebp, %ecx
decq %rcx
jne 0x4e528
jmp 0x4e534
movl $0x1, %ebp
leaq 0x9ae2(%rip), %rdx      # 0x5801d
movl %r13d, %edi
movq %r12, %rsi
callq 0xe439
movl %eax, %r15d
leaq 0xac72(%rip), %rdx      # 0x591c2
movl %r13d, %edi
movq %r12, %rsi
callq 0xe439
movl %eax, %ebx
leaq 0xac6a(%rip), %rdx      # 0x591ce
xorl %r14d, %r14d
movl %r13d, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xe4b3
movq %rax, 0x30(%rsp)
leaq 0xac51(%rip), %rdx      # 0x591d1
movl %r13d, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xe4b3
movq %rax, 0x28(%rsp)
leaq 0xac3b(%rip), %rdx      # 0x591d4
movl %r13d, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xe4b3
cmpl $0x6, %r13d
jl 0x4e5b1
movq 0x28(%r12), %r14
cmpl $0x7, %r13d
movq %rbx, 0x38(%rsp)
movq %rax, 0x20(%rsp)
jl 0x4e5cd
movq 0x30(%r12), %rax
movq %rax, 0x10(%rsp)
jmp 0x4e5d6
movq $0x0, 0x10(%rsp)
movq 0x18(%r12), %r13
movq 0x20(%r12), %rbx
movq 0x10(%r12), %r12
leaq 0xab11(%rip), %rsi      # 0x590fd
movq %r12, %rdi
callq 0x3270
testl %eax, %eax
je 0x4e703
leaq 0x9cd9(%rip), %rsi      # 0x582dc
movq %r12, %rdi
callq 0x3270
testl %eax, %eax
je 0x4e734
leaq 0x7972(%rip), %rsi      # 0x55f8c
movq %r12, %rdi
callq 0x3270
testl %eax, %eax
je 0x4e76d
leaq 0xaba8(%rip), %rsi      # 0x591d9
movq %r12, %rdi
callq 0x3270
testl %eax, %eax
je 0x4e78e
leaq 0xa9cf(%rip), %rsi      # 0x59017
movq %r12, %rdi
callq 0x3270
testl %eax, %eax
je 0x4e7af
leaq 0xa5f0(%rip), %rsi      # 0x58c4f
movq %r12, %rdi
callq 0x3270
testl %eax, %eax
jne 0x4e75e
movq %r13, %rdi
callq 0x34b9c
movq %rax, %r15
leaq 0x8b1a(%rip), %rsi      # 0x5719b
movq %rax, %rdi
movl $0x14, %edx
callq 0x34d9f
movl %eax, %ebp
leaq 0x9052(%rip), %rsi      # 0x576e9
leaq 0xaab6(%rip), %rdx      # 0x59154
movq %r15, %rdi
callq 0x34d5b
movq %rax, %rdi
callq 0x2b6d3
subq $0x8, %rsp
movq %rbx, %rdi
movq %r14, %rsi
movss 0xc(%rsp), %xmm0
movl 0x24(%rsp), %edx
movq 0x18(%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 0x7f1c
addq $0x98, %rsp
jmp 0x4e762
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
movss 0x4(%rsp), %xmm0
movss (%rsp), %xmm1
movq 0x8(%rsp), %r8
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4e170
movq %r13, %rdi
movq %rbx, %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 0x4d4fc
movq %r12, %rdi
callq 0xd861
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq 0x8(%rsp), %rcx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcbd7
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq 0x8(%rsp), %rcx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc2a2
movq %rbx, %rdi
movq %r14, %rsi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd462