// File: /workspace/github_c_makefile_star2_O3/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, %r14d
movl %edx, %r15d
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x2b561(%rip), %rsi     # 0x58a4f
leaq 0x2b57e(%rip), %r13     # 0x58a73
leaq 0x40(%rsp), %r12
movq %rax, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x2b54e(%rip), %rsi     # 0x58a5d
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x2a308(%rip), %rsi     # 0x5782c
leaq 0x2d3e6(%rip), %r13     # 0x5a911
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x2b528(%rip), %rsi     # 0x58a68
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x2b518(%rip), %rsi     # 0x58a6d
movq %r12, %rdi
movq %r13, %rdx
movq %rbp, %r13
movq %r12, %rcx
callq 0xf02d
leal 0x1(%rbp), %ecx
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x15d43
movl %r14d, %eax
imull %r15d, %eax
movl %eax, %ebp
movq %rax, 0x20(%rsp)
testl %eax, %eax
jle 0x2d6a0
movq 0x10(%rbx), %rcx
movq 0x20(%rsp), %rsi
movl %esi, %eax
imull %r13d, %eax
movslq %eax, %rdx
leal 0x3(%rsi), %eax
andl $-0x4, %eax
leaq -0x1(%rbp), %rsi
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq (%rcx,%rdx,4), %rcx
addq $0xc, %rcx
movdqa 0x27bad(%rip), %xmm1    # 0x55170
movdqa 0x27ab5(%rip), %xmm2    # 0x55080
xorl %edx, %edx
movdqa 0x27abb(%rip), %xmm3    # 0x55090
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x27b9b(%rip), %xmm5    # 0x55180
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0x2d622
movl $0x3f800000, -0xc(%rcx,%rdx,4) # imm = 0x3F800000
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0x2d639
movl $0x3f800000, -0x8(%rcx,%rdx,4) # imm = 0x3F800000
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %esi
testb $0x1, %sil
je 0x2d679
movl $0x3f800000, -0x4(%rcx,%rdx,4) # imm = 0x3F800000
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0x2d68b
movl $0x3f800000, (%rcx,%rdx,4) # imm = 0x3F800000
addq $0x4, %rdx
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
cmpq %rdx, %rax
jne 0x2d5e5
leaq 0x2d782(%rip), %rsi     # 0x5ae29
leaq 0x40(%rsp), %rdi
callq 0x3390
movq %rax, %r12
testq %rax, %rax
jne 0x2d6c3
leaq 0x40(%rsp), %rdi
callq 0xe925
leaq 0x28(%rsp), %rdi
movl %r15d, %esi
movl %r14d, %edx
movl $0x1, %ecx
callq 0x15d43
leaq 0x2b399(%rip), %rsi     # 0x58a78
leaq 0x1c(%rsp), %rdx
leaq 0x1040(%rsp), %rcx
movq %r12, %rdi
xorl %eax, %eax
callq 0x30a0
cmpl $0x2, %eax
jne 0x2d7e6
imull 0x20(%rsp), %r13d
movslq %r13d, %r13
leaq 0x1040(%rsp), %r14
movl $0x0, 0x18(%rsp)
movq %r14, %rdi
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0xe7d7
movq %rax, %r15
movl 0x18(%rsp), %esi
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0x2bb35
movq 0x10(%rbx), %rcx
movl 0x2c(%rsp), %edx
movq 0x38(%rsp), %rax
imull 0x28(%rsp), %edx
testl %edx, %edx
pxor %xmm1, %xmm1
jle 0x2d794
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 0x2d785
jnp 0x2d78c
movl $0x3f800000, (%rsi,%rdi,4) # imm = 0x3F800000
incq %rdi
cmpq %rdi, %rdx
jne 0x2d779
cmpl $0x0, 0x20(%rsp)
jle 0x2d7bc
leaq (%rcx,%r13,4), %rcx
xorl %edx, %edx
movss (%rax,%rdx,4), %xmm0
ucomiss %xmm1, %xmm0
jne 0x2d7ad
jnp 0x2d7b4
movl $0x0, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %rbp
jne 0x2d7a1
movq %r15, %rdi
callq 0x3040
movq %r12, %rdi
leaq 0x2b2aa(%rip), %rsi     # 0x58a78
leaq 0x1c(%rsp), %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x30a0
cmpl $0x2, %eax
je 0x2d710
movq %r12, %rdi
callq 0x3130
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
movq %rbx, %rax
addq $0x9058, %rsp           # imm = 0x9058
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq