// File: /workspace/github_c_makefile_star2_O0/ender672[P]liboil/benchmark.c
// Function: main
int main(int argc, char *argv[])
{
	clock_t t;
	size_t i, num_spaces;
	int iterations;
	char *end;

	enum oil_colorspace spaces[] = {
		OIL_CS_G,
		OIL_CS_GA,
		OIL_CS_RGB,
		OIL_CS_RGBX,
		OIL_CS_RGBA,
		OIL_CS_CMYK,
	};

	char *space_names[] = {
		"G",
		"GA",
		"RGB",
		"RGBX",
		"RGBA",
		"CMYK",
	};

	if (argc < 2 || argc > 3) {
		fprintf(stderr, "Usage: %s <path> [colorspace]\n", argv[0]);
		return 1;
	}

	iterations = 100;
	if (getenv("OILITERATIONS")) {
		iterations = strtoul(getenv("OILITERATIONS"), &end, 10);
		if (!end) {
			fprintf(stderr, "Invalid environment variable OILITERATIONS.");
			return 1;
		}
	}
	fprintf(stderr, "Iterations: %d\n", iterations);

	t = clock();
	oil_global_init();
	t = clock() - t;
	printf("global init: %6.2fms\n", time_to_ms(t));

	num_spaces = sizeof(spaces)/sizeof(spaces[0]);
	if (argc == 2) {
		for (i=0; i<num_spaces; i++) {
			do_bench_sizes(space_names[i], argv[1], spaces[i], iterations);
		}
		return 0;
	}

	for (i=0; i<num_spaces; i++) {
		if (strcmp(space_names[i], argv[2]) == 0) {
			break;
		}
	}

	if (i >= num_spaces) {
		fprintf(stderr, "Colorspace not recognized.\n");
		return 1;
	}

	do_bench_sizes(space_names[i], argv[1], spaces[i], iterations);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0xa20(%rip), %rax       # 0x5220
movq %rax, -0x50(%rbp)
movq 0xa1d(%rip), %rax       # 0x5228
movq %rax, -0x48(%rbp)
movq 0xa1a(%rip), %rax       # 0x5230
movq %rax, -0x40(%rbp)
leaq -0x80(%rbp), %rdi
leaq 0x256b(%rip), %rsi      # 0x6d90
movl $0x30, %edx
callq 0x1130
cmpl $0x2, -0x8(%rbp)
jl 0x483b
cmpl $0x3, -0x8(%rbp)
jle 0x4866
movq 0x27ae(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x8bf(%rip), %rsi       # 0x5112
movb $0x0, %al
callq 0x1120
movl $0x1, -0x4(%rbp)
jmp 0x4a06
movl $0x64, -0x2c(%rbp)
leaq 0x8bd(%rip), %rdi       # 0x5131
callq 0x1030
cmpq $0x0, %rax
je 0x48cc
leaq 0x8ab(%rip), %rdi       # 0x5131
callq 0x1030
movq %rax, %rdi
leaq -0x38(%rbp), %rsi
movl $0xa, %edx
callq 0x11d0
movl %eax, -0x2c(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x48ca
movq 0x2743(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0x888(%rip), %rsi       # 0x513f
movb $0x0, %al
callq 0x1120
movl $0x1, -0x4(%rbp)
jmp 0x4a06
jmp 0x48cc
movq 0x271d(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
movl -0x2c(%rbp), %edx
leaq 0x88b(%rip), %rsi       # 0x516b
movb $0x0, %al
callq 0x1120
callq 0x10a0
movq %rax, -0x18(%rbp)
callq 0x1310
callq 0x10a0
subq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x41a0
leaq 0x869(%rip), %rdi       # 0x517b
movb $0x1, %al
callq 0x10d0
movq $0x6, -0x28(%rbp)
cmpl $0x2, -0x8(%rbp)
jne 0x4974
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x4968
movq -0x20(%rbp), %rax
movq -0x80(%rbp,%rax,8), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movl -0x50(%rbp,%rax,4), %edx
movl -0x2c(%rbp), %ecx
callq 0x43d0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x492f
movl $0x0, -0x4(%rbp)
jmp 0x4a06
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x49b3
movq -0x20(%rbp), %rax
movq -0x80(%rbp,%rax,8), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x1110
cmpl $0x0, %eax
jne 0x49a3
jmp 0x49b3
jmp 0x49a5
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x497c
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jb 0x49de
movq 0x262c(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0x7c3(%rip), %rsi       # 0x5191
movb $0x0, %al
callq 0x1120
movl $0x1, -0x4(%rbp)
jmp 0x4a06
movq -0x20(%rbp), %rax
movq -0x80(%rbp,%rax,8), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movl -0x50(%rbp,%rax,4), %edx
movl -0x2c(%rbp), %ecx
callq 0x43d0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq