// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: save_image_options
void save_image_options(image im, const char *name, IMTYPE f, int quality)
{
    char buff[256];
    //sprintf(buff, "%s (%d)", name, windows);
    if(f == PNG)       sprintf(buff, "%s.png", name);
    else if (f == BMP) sprintf(buff, "%s.bmp", name);
    else if (f == TGA) sprintf(buff, "%s.tga", name);
    else if (f == JPG) sprintf(buff, "%s.jpg", name);
    else               sprintf(buff, "%s.png", name);
    unsigned char *data = calloc(im.w*im.h*im.c, sizeof(char));
    int i,k;
    for(k = 0; k < im.c; ++k){
        for(i = 0; i < im.w*im.h; ++i){
            data[i*im.c+k] = (unsigned char) (255*im.data[i + k*im.w*im.h]);
        }
    }
    int success = 0;
    if(f == PNG)       success = stbi_write_png(buff, im.w, im.h, im.c, data, im.w*im.c);
    else if (f == BMP) success = stbi_write_bmp(buff, im.w, im.h, im.c, data);
    else if (f == TGA) success = stbi_write_tga(buff, im.w, im.h, im.c, data);
    else if (f == JPG) success = stbi_write_jpg(buff, im.w, im.h, im.c, data, quality);
    free(data);
    if(!success) fprintf(stderr, "Failed to write image %s\n", buff);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
leaq 0x10(%rbp), %rax
movq %rax, -0x130(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x113c4
leaq -0x110(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x61d6a(%rip), %rsi     # 0x73122
movb $0x0, %al
callq 0x33f0
jmp 0x11446
cmpl $0x1, -0xc(%rbp)
jne 0x113e5
leaq -0x110(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x61d4d(%rip), %rsi     # 0x73129
movb $0x0, %al
callq 0x33f0
jmp 0x11444
cmpl $0x2, -0xc(%rbp)
jne 0x11406
leaq -0x110(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x61d33(%rip), %rsi     # 0x73130
movb $0x0, %al
callq 0x33f0
jmp 0x11442
cmpl $0x3, -0xc(%rbp)
jne 0x11427
leaq -0x110(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x61d19(%rip), %rsi     # 0x73137
movb $0x0, %al
callq 0x33f0
jmp 0x11440
leaq -0x110(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq 0x61ce9(%rip), %rsi     # 0x73122
movb $0x0, %al
callq 0x33f0
jmp 0x11442
jmp 0x11444
jmp 0x11446
movq -0x130(%rbp), %rcx
movl (%rcx), %eax
imull 0x4(%rcx), %eax
imull 0x8(%rcx), %eax
movslq %eax, %rdi
movl $0x1, %esi
callq 0x3220
movq %rax, -0x118(%rbp)
movl $0x0, -0x120(%rbp)
movq -0x130(%rbp), %rcx
movl -0x120(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x11533
movl $0x0, -0x11c(%rbp)
movq -0x130(%rbp), %rdx
movl -0x11c(%rbp), %eax
movl (%rdx), %ecx
imull 0x4(%rdx), %ecx
cmpl %ecx, %eax
jge 0x1151d
movq -0x130(%rbp), %rsi
movq 0x10(%rsi), %rax
movl -0x11c(%rbp), %ecx
movl -0x120(%rbp), %edx
movl (%rsi), %r8d
movl 0x4(%rsi), %edi
imull %r8d, %edx
imull %edi, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss 0x5fd3e(%rip), %xmm1    # 0x71220
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movb %al, %dl
movq -0x118(%rbp), %rax
movl -0x11c(%rbp), %ecx
imull 0x8(%rsi), %ecx
addl -0x120(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x11495
jmp 0x1151f
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0x11475
movl $0x0, -0x124(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x11578
movq -0x130(%rbp), %rax
leaq -0x110(%rbp), %rdi
movl (%rax), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
movq -0x118(%rbp), %r8
movl (%rax), %r9d
imull 0x8(%rax), %r9d
callq 0xd560
movl %eax, -0x124(%rbp)
jmp 0x11610
cmpl $0x1, -0xc(%rbp)
jne 0x115a8
movq -0x130(%rbp), %rax
leaq -0x110(%rbp), %rdi
movl (%rax), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
movq -0x118(%rbp), %r8
callq 0xac20
movl %eax, -0x124(%rbp)
jmp 0x1160e
cmpl $0x2, -0xc(%rbp)
jne 0x115d8
movq -0x130(%rbp), %rax
leaq -0x110(%rbp), %rdi
movl (%rax), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
movq -0x118(%rbp), %r8
callq 0xb240
movl %eax, -0x124(%rbp)
jmp 0x1160c
cmpl $0x3, -0xc(%rbp)
jne 0x1160a
movq -0x130(%rbp), %rax
leaq -0x110(%rbp), %rdi
movl (%rax), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
movq -0x118(%rbp), %r8
movl -0x10(%rbp), %r9d
callq 0xe0f0
movl %eax, -0x124(%rbp)
jmp 0x1160c
jmp 0x1160e
jmp 0x11610
movq -0x118(%rbp), %rdi
callq 0x3030
cmpl $0x0, -0x124(%rbp)
jne 0x11644
movq 0x719cc(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq -0x110(%rbp), %rdx
leaq 0x61b01(%rip), %rsi     # 0x7313e
movb $0x0, %al
callq 0x3240
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopl (%rax)