// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/data.c
// Function: get_segmentation_image2
image get_segmentation_image2(char *path, int w, int h, int classes)
{
    char labelpath[4096];
    find_replace(path, "images", "mask", labelpath);
    find_replace(labelpath, "JPEGImages", "mask", labelpath);
    find_replace(labelpath, ".jpg", ".txt", labelpath);
    find_replace(labelpath, ".JPG", ".txt", labelpath);
    find_replace(labelpath, ".JPEG", ".txt", labelpath);
    image mask = make_image(w, h, classes+1);
    int i;
    for(i = 0; i < w*h; ++i){
        mask.data[w*h*classes + i] = 1;
    }
    FILE *file = fopen(labelpath, "r");
    if(!file) file_error(labelpath);
    char buff[32788];
    int id;
    image part = make_image(w, h, 1);
    while(fscanf(file, "%d %s", &id, buff) == 2){
        int n = 0;
        int *rle = read_intlist(buff, &n, 0);
        load_rle(part, rle, n);
        or_image(part, mask, id);
        for(i = 0; i < w*h; ++i){
            if(part.data[i]) mask.data[w*h*classes + i] = 0;
        }
        free(rle);
    }
    //exclusive_image(mask);
    fclose(file);
    free_image(part);
    return mask;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9058, %rsp           # imm = 0x9058
movl %r8d, %ebp
movl %ecx, %r15d
movl %edx, %r12d
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x2affa(%rip), %rsi     # 0x5694f
leaq 0x2b017(%rip), %r13     # 0x56973
leaq 0x40(%rsp), %r14
movq %rax, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0xe842
leaq 0x2afe7(%rip), %rsi     # 0x5695d
movq %r14, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0xe842
leaq 0x29dc9(%rip), %rsi     # 0x55754
leaq 0x2ce27(%rip), %r13     # 0x587b9
movq %r14, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0xe842
leaq 0x2afc1(%rip), %rsi     # 0x56968
movq %r14, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0xe842
leaq 0x2afb1(%rip), %rsi     # 0x5696d
movq %r14, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0xe842
movq %rbp, 0x20(%rsp)
leal 0x1(%rbp), %ecx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x1529e
movl %r15d, %ebp
imull %r12d, %ebp
movl %ebp, %r13d
testl %ebp, %ebp
jle 0x2ba10
movl %ebp, %eax
imull 0x20(%rsp), %eax
cltq
shlq $0x2, %rax
addq 0x10(%rbx), %rax
xorl %ecx, %ecx
movl $0x3f800000, (%rax,%rcx,4) # imm = 0x3F800000
incq %rcx
cmpq %rcx, %r13
jne 0x2ba01
leaq 0x2d2ba(%rip), %rsi     # 0x58cd1
leaq 0x40(%rsp), %rdi
callq 0x33a0
movq %rax, %r14
testq %rax, %rax
jne 0x2ba33
leaq 0x40(%rsp), %rdi
callq 0xe142
leaq 0x28(%rsp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movl $0x1, %ecx
callq 0x1529e
leaq 0x2af29(%rip), %rsi     # 0x56978
leaq 0x1c(%rsp), %rdx
leaq 0x1040(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x30b0
cmpl $0x2, %eax
jne 0x2bb5d
movq 0x20(%rsp), %rax
imull %ebp, %eax
cltq
movq %rax, 0x20(%rsp)
leaq 0x1040(%rsp), %r15
movl $0x0, 0x18(%rsp)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0xe017
movq %rax, %r12
movl 0x18(%rsp), %esi
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
callq 0x2a37e
movq 0x10(%rbx), %rcx
movl 0x2c(%rsp), %edx
movq 0x38(%rsp), %rax
imull 0x28(%rsp), %edx
testl %edx, %edx
xorps %xmm1, %xmm1
jle 0x2bb09
movl (%rbx), %esi
imull 0x4(%rbx), %esi
imull 0x1c(%rsp), %esi
movslq %esi, %rsi
movl %edx, %edx
leaq (%rcx,%rsi,4), %rsi
xorl %edi, %edi
movss (%rax,%rdi,4), %xmm0
ucomiss %xmm1, %xmm0
jne 0x2bafa
jnp 0x2bb01
movl $0x3f800000, (%rsi,%rdi,4) # imm = 0x3F800000
incq %rdi
cmpq %rdi, %rdx
jne 0x2baee
testl %ebp, %ebp
jle 0x2bb33
movq 0x20(%rsp), %rdx
leaq (%rcx,%rdx,4), %rcx
xorl %edx, %edx
movss (%rax,%rdx,4), %xmm0
ucomiss %xmm1, %xmm0
jne 0x2bb24
jnp 0x2bb2b
movl $0x0, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %r13
jne 0x2bb18
movq %r12, %rdi
callq 0x3040
movq %r14, %rdi
leaq 0x2ae33(%rip), %rsi     # 0x56978
leaq 0x1c(%rsp), %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x30b0
cmpl $0x2, %eax
je 0x2ba86
movq %r14, %rdi
callq 0x3140
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq %rbx, %rax
addq $0x9058, %rsp           # imm = 0x9058
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq