// File: /workspace/github_c_makefile_star2_O1/ender672[P]liboil/oil_libpng.c
// Function: oil_libpng_init
int oil_libpng_init(struct oil_libpng *ol, png_structp rpng, png_infop rinfo,
	int out_width, int out_height)
{
	int ret, in_width, in_height, buf_len;
	enum oil_colorspace cs;

	ol->rpng = rpng;
	ol->rinfo = rinfo;
	ol->in_vpos = 0;
	ol->inbuf = NULL;
	ol->inimage = NULL;

	cs = png_cs_to_oil(png_get_color_type(rpng, rinfo));
	if (cs == OIL_CS_UNKNOWN) {
		return -1;
	}

	in_width = png_get_image_width(rpng, rinfo);
	in_height = png_get_image_height(rpng, rinfo);
	ret = oil_scale_init(&ol->os, in_height, out_height, in_width,
		out_width, cs);
	if (ret!=0) {
		free(ol->inbuf);
		return ret;
	}

	buf_len = png_get_rowbytes(rpng, rinfo);
	switch (png_get_interlace_type(rpng, rinfo)) {
	case PNG_INTERLACE_NONE:
		ol->inbuf = malloc(buf_len);
		if (!ol->inbuf) {
			oil_scale_free(&ol->os);
			return -2;
		}
		break;
	case PNG_INTERLACE_ADAM7:
		ol->inimage = alloc_full_image_buf(in_height, buf_len);
		if (!ol->inimage) {
			oil_scale_free(&ol->os);
			return -2;
		}
		png_read_image(rpng, ol->inimage);
		break;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movl %ecx, 0xc(%rsp)
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, 0x58(%rdi)
movq %rdx, 0x60(%rdi)
movl $0x0, 0x68(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rdi)
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x2140
xorl %r13d, %r13d
cmpb $0x6, %al
movl %ebp, 0x8(%rsp)
ja 0x477e
movzbl %al, %eax
leaq 0xa60(%rip), %rcx       # 0x5148
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, %r13d
jmp 0x470f
movl $0x2, %r13d
jmp 0x470f
movl $0x3, %r13d
jmp 0x470f
movl $0x104, %r13d           # imm = 0x104
xorl %eax, %eax
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testb %al, %al
jne 0x476c
leaq 0x70(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2130
movl %eax, %r12d
movq %r14, %rdi
movq %r15, %rsi
callq 0x2300
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
movl 0x8(%rsp), %edx
movl %r12d, %ecx
movl 0xc(%rsp), %r8d
movl %r13d, %r9d
callq 0x27ac
testl %eax, %eax
je 0x4782
movl %eax, %r12d
movq 0x10(%rsp), %rax
movq (%rax), %rdi
callq 0x21b0
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x4711
movl %ebp, %r12d
movq 0x10(%rsp), %rbp
movq %r14, %rdi
movq %r15, %rsi
callq 0x2230
movq %rax, %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x2200
cmpb $0x1, %al
je 0x47c7
movzbl %al, %eax
xorl %r12d, %r12d
testl %eax, %eax
jne 0x476c
movslq %r13d, %rdi
callq 0x20e0
movq %rax, (%rbp)
testq %rax, %rax
jne 0x476c
jmp 0x484c
movl %r12d, %ebp
movslq %r12d, %rdi
shlq $0x3, %rdi
callq 0x20e0
testq %rax, %rax
je 0x482d
movq %rax, %r15
testl %ebp, %ebp
jle 0x4830
movslq %r13d, %r12
movl %ebp, %ebp
xorl %r13d, %r13d
movq %r12, %rdi
callq 0x20e0
movq %rax, (%r15,%r13,8)
testq %rax, %rax
je 0x4805
incq %r13
cmpq %r13, %rbp
jne 0x47ea
jmp 0x4830
cmpq $0x2, %r13
jb 0x4825
decq %r13
movl %r13d, %r12d
xorl %r13d, %r13d
movq (%r15,%r13,8), %rdi
callq 0x21b0
incq %r13
cmpq %r13, %r12
jne 0x4814
movq %r15, %rdi
callq 0x21b0
xorl %r15d, %r15d
movq %r15, 0x78(%rbx)
testq %r15, %r15
je 0x484c
movq %r14, %rdi
movq %r15, %rsi
callq 0x2310
xorl %r12d, %r12d
jmp 0x476c
movq %rbx, %rdi
callq 0x2a65
movl $0xfffffffe, %r12d      # imm = 0xFFFFFFFE
jmp 0x476c