// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/segmenter.c
// Function: run_segmenter
void run_segmenter(int argc, char **argv)
{
    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);
    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 cam_index = find_int_arg(argc, argv, "-c", 0);
    int clear = find_arg(argc, argv, "-clear");
    int display = find_arg(argc, argv, "-display");
    char *data = 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")) predict_segmenter(data, cfg, weights, filename);
    else if(0==strcmp(argv[2], "train")) train_segmenter(data, cfg, weights, gpus, ngpus, clear, display);
    else if(0==strcmp(argv[2], "demo")) demo_segmenter(data, cfg, weights, cam_index, filename);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
cmpl $0x3, %edi
jle 0x3f6d4
movl %edi, %r14d
leaq 0x1231f(%rip), %rdx     # 0x518cc
xorl %r12d, %r12d
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x4151
testq %rax, %rax
je 0x3f5fb
movq %rax, %r15
movq %rax, %rdi
callq 0x30b0
movq %r15, %rdi
callq 0x3140
testl %eax, %eax
cmovlel %r12d, %eax
pushq $0x1
popq %rbp
cmpq %r12, %rax
je 0x3f5f1
xorl %ecx, %ecx
cmpb $0x2c, (%r15,%r12)
sete %cl
addl %ecx, %ebp
incq %r12
jmp 0x3f5db
movl %ebp, %eax
subq $0x1, %rax
jae 0x3f5f3
jmp 0x3f5fe
pushq $0x1
popq %rbp
leaq 0x11b3a(%rip), %rdx     # 0x5113f
xorl %r15d, %r15d
movl %r14d, %edi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x4041
leaq 0x11a39(%rip), %rdx     # 0x51055
movl %r14d, %edi
movq %rbx, %rsi
callq 0x3fdd
movl %eax, %r12d
leaq 0x11a2b(%rip), %rdx     # 0x5105c
movl %r14d, %edi
movq %rbx, %rsi
callq 0x3fdd
cmpl $0x6, %r14d
movl %r12d, 0x14(%rsp)
movl %eax, 0x10(%rsp)
jl 0x3f651
movq 0x28(%rbx), %r15
jne 0x3f656
xorl %r13d, %r13d
jmp 0x3f65a
movq 0x30(%rbx), %r13
movq 0x18(%rbx), %r12
movq 0x20(%rbx), %r14
movq 0x10(%rbx), %rbx
leaq 0x12aa8(%rip), %rsi     # 0x52115
movq %rbx, %rdi
callq 0x3260
testl %eax, %eax
je 0x3f6b8
leaq 0x11c94(%rip), %rsi     # 0x51314
movq %rbx, %rdi
callq 0x3260
testl %eax, %eax
jne 0x3f6a9
movl 0x10(%rsp), %eax
movl %eax, (%rsp)
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %ebp, %r8d
movl 0x14(%rsp), %r9d
callq 0x3eb78
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3f37e
movq 0x2491d(%rip), %rax     # 0x63ff8
movq (%rax), %rdi
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
leaq 0x118ee(%rip), %rsi     # 0x50fda
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3270
nopl (%rax)