// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x68(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x70(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2130
movzbl %al, %edi
callq 0x5740
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0x5620
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x572c
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2120
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x22f0
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
movl -0x28(%rbp), %edx
movl -0x30(%rbp), %ecx
movl -0x24(%rbp), %r8d
movl -0x3c(%rbp), %r9d
callq 0x2740
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x567b
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
callq 0x21a0
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x572c
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2220
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x21f0
movzbl %al, %ecx
movl %ecx, -0x40(%rbp)
testb %al, %al
je 0x56ae
jmp 0x56a4
movl -0x40(%rbp), %eax
subl $0x1, %eax
je 0x56e1
jmp 0x5725
movslq -0x38(%rbp), %rdi
callq 0x20d0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x70(%rax)
jne 0x56df
movq -0x10(%rbp), %rdi
callq 0x2b00
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x572c
jmp 0x5725
movl -0x34(%rbp), %edi
movl -0x38(%rbp), %esi
callq 0x57a0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x78(%rax)
jne 0x5714
movq -0x10(%rbp), %rdi
callq 0x2b00
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x572c
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rsi
callq 0x2300
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)