// File: /workspace/github_c_makefile_star2_O0/ender672[P]liboil/benchmark.c
// Function: png
static struct bench_image png(char *path, enum oil_colorspace cs)
{
	struct bench_image bench_image;
	int i;
	png_structp rpng;
	png_infop rinfo;
	FILE *input;
	size_t row_stride, buf_len;
	unsigned char **buf_ptrs;

	rpng = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
	if (setjmp(png_jmpbuf(rpng))) {
		fprintf(stderr, "PNG Decoding Error.\n");
		exit(1);
	}

	input = fopen(path, "r");
	if (!input) {
		fprintf(stderr, "Unable to open file.\n");
		exit(1);
	}

	rinfo = png_create_info_struct(rpng);
	png_init_io(rpng, input);
	png_read_info(rpng, rinfo);

	if (png_get_color_type(rpng, rinfo) != PNG_COLOR_TYPE_RGBA) {
		fprintf(stderr, "Input image must be RGBA.\n");
		exit(1);
	};

	switch(cs) {
	case OIL_CS_G:
		png_set_rgb_to_gray(rpng, 1, -1, -1);
		png_set_strip_alpha(rpng);
		break;
	case OIL_CS_GA:
		png_set_rgb_to_gray(rpng, 1, -1, -1);
		break;
	case OIL_CS_RGB:
		png_set_strip_alpha(rpng);
		break;
	case OIL_CS_RGBX:
		png_set_strip_alpha(rpng);
		png_set_filler(rpng, 0xffff, PNG_FILLER_AFTER);
		break;
	case OIL_CS_CMYK: /* Kind of cheating on CMYK by giving it RGBA */
	case OIL_CS_RGBA:
	case OIL_CS_UNKNOWN:
		break;
	}

	bench_image.width = png_get_image_width(rpng, rinfo);
	bench_image.height = png_get_image_height(rpng, rinfo);
	bench_image.cs = cs;

	row_stride = bench_image.width * OIL_CMP(cs);
	buf_len = (size_t)bench_image.height * row_stride;
	bench_image.buffer = malloc(buf_len);
	buf_ptrs = malloc(bench_image.height * sizeof(unsigned char *));
	if (!bench_image.buffer || !buf_ptrs) {
		fprintf(stderr, "Unable to allocate buffers.\n");
		exit(1);
	}

	for (i=0; i<bench_image.height; i++) {
		buf_ptrs[i] = bench_image.buffer + i * row_stride;
	}

	png_read_image(rpng, buf_ptrs);
	png_destroy_read_struct(&rpng, &rinfo, NULL);

	free(buf_ptrs);
	fclose(input);
	return bench_image;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, -0x48(%rbp)
movq %rsi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
leaq 0xc9f(%rip), %rdi       # 0x51ad
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rsi
movq %rcx, %rdx
callq 0x1200
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq 0x2aac(%rip), %rsi      # 0x6fd8
movl $0xc8, %edx
callq 0x10c0
movq %rax, %rdi
callq 0x10f0
cmpl $0x0, %eax
je 0x4565
movq 0x2aa6(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0xc60(%rip), %rsi       # 0x51b4
movb $0x0, %al
callq 0x1120
movl $0x1, %edi
callq 0x11e0
movq -0x8(%rbp), %rdi
leaq 0xc59(%rip), %rsi       # 0x51c9
callq 0x11c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x45a2
movq 0x2a69(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0xc3a(%rip), %rsi       # 0x51cb
movb $0x0, %al
callq 0x1120
movl $0x1, %edi
callq 0x11e0
movq -0x18(%rbp), %rdi
callq 0x1140
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x11a0
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1170
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1070
movzbl %al, %eax
cmpl $0x6, %eax
je 0x4600
movq 0x2a0b(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0xbf2(%rip), %rsi       # 0x51e1
movb $0x0, %al
callq 0x1120
movl $0x1, %edi
callq 0x11e0
movl -0xc(%rbp), %eax
movl %eax, -0x54(%rbp)
testl %eax, %eax
je 0x46b8
jmp 0x4610
movl -0x54(%rbp), %eax
subl $0x1, %eax
je 0x4650
jmp 0x461a
movl -0x54(%rbp), %eax
subl $0x2, %eax
je 0x4674
jmp 0x4624
movl -0x54(%rbp), %eax
subl $0x3, %eax
je 0x468f
jmp 0x462e
movl -0x54(%rbp), %eax
subl $0x4, %eax
je 0x469a
jmp 0x4638
movl -0x54(%rbp), %eax
subl $0x104, %eax            # imm = 0x104
je 0x46b8
jmp 0x4644
movl -0x54(%rbp), %eax
subl $0x204, %eax            # imm = 0x204
je 0x46b8
jmp 0x46ba
movq -0x18(%rbp), %rdi
movl $0x1, %esi
movsd 0xa07(%rip), %xmm1      # 0x5068
movaps %xmm1, %xmm0
callq 0x1080
movq -0x18(%rbp), %rdi
callq 0x1190
jmp 0x46ba
movq -0x18(%rbp), %rdi
movl $0x1, %esi
movsd 0x9e3(%rip), %xmm1      # 0x5068
movaps %xmm1, %xmm0
callq 0x1080
jmp 0x46ba
movq -0x18(%rbp), %rdi
callq 0x1190
jmp 0x46ba
movq -0x18(%rbp), %rdi
callq 0x1190
movq -0x18(%rbp), %rdi
movl $0xffff, %esi           # imm = 0xFFFF
movl $0x1, %edx
callq 0x1160
jmp 0x46ba
jmp 0x46ba
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x11b0
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x11f0
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0xc(%rbp), %ecx
movl %ecx, 0x10(%rax)
movl 0x8(%rax), %ecx
movl -0xc(%rbp), %edx
andl $0xff, %edx
imull %edx, %ecx
movl %ecx, %ecx
movq %rcx, -0x30(%rbp)
movslq 0xc(%rax), %rax
imulq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1150
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movslq 0xc(%rax), %rdi
shlq $0x3, %rdi
callq 0x1150
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x40(%rbp)
cmpq $0x0, (%rax)
je 0x4746
cmpq $0x0, -0x40(%rbp)
jne 0x4768
movq 0x28a3(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0xaa5(%rip), %rsi       # 0x51fc
movb $0x0, %al
callq 0x1120
movl $0x1, %edi
callq 0x11e0
movl $0x0, -0x10(%rbp)
movq -0x50(%rbp), %rcx
movl -0x10(%rbp), %eax
cmpl 0xc(%rcx), %eax
jge 0x47a5
movq -0x50(%rbp), %rax
movq (%rax), %rdx
movslq -0x10(%rbp), %rax
imulq -0x30(%rbp), %rax
addq %rax, %rdx
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x476f
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1050
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x1180
movq -0x40(%rbp), %rdi
callq 0x1040
movq -0x28(%rbp), %rdi
callq 0x10b0
movq -0x48(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop