// File: /workspace/github_c_makefile_star2_O1/igaw[P]jitterdebugger/jittersamples.c
// Function: main
int main(int argc, char *argv[])
{
	FILE *input;
	int c, long_idx;
	char *format = "csv";
	char *port = NULL;
	struct jd_samples_info info;
	struct jd_slist *list;

	while (1) {
		c = getopt_long(argc, argv, "hf:l:", long_options, &long_idx);
		if (c < 0)
			break;

		switch (c) {
		case 0:
			if (!strcmp(long_options[long_idx].name, "version")) {
				printf("jittersamples %s\n",
					JD_VERSION);
				exit(0);
			}
			break;
		case 'h':
			usage(0);
		case 'f':
			format = optarg;
			break;
		case 'l':
			port = optarg;
			break;
		default:
			printf("unknown option\n");
			usage(1);
		}
	}

	if (port) {
		dump_samples(port);
		exit(0);
	}

	if (optind == argc) {
		fprintf(stderr, "Missing input DIR\n");
		usage(1);
	}
	info.dir = argv[optind];

	read_online_cpus(&info);

	__jd_plugin_init();

	input = jd_fopen(info.dir, "samples.raw", "r");
	if (!input)
		err_handler(errno, "Could not open '%s/samples.raw' for reading", info.dir);

	for (list = jd_samples_plugins.next; list; list = list->next) {
		struct jd_samples_ops *plugin = list->data;

		if (strcmp(plugin->format, format))
			continue;

		plugin->output(&info, input);
		break;
	}

	fclose(input);

	__jd_plugin_cleanup();

	if (!list) {
		fprintf(stderr, "Unsupported file format \"%s\"\n", format);
		exit(1);
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movl %edi, %ebp
leaq 0x12c3(%rip), %rdx      # 0x4270
leaq 0x31ec(%rip), %r15      # 0x61a0
leaq 0xc(%rsp), %r8
movq %r15, %rcx
callq 0x20f0
leaq 0x1188(%rip), %rbx      # 0x4150
testl %eax, %eax
js 0x3057
movq $0x0, 0x10(%rsp)
leaq 0x1290(%rip), %r13      # 0x4270
leaq 0xc(%rsp), %r12
cmpl $0x67, %eax
jg 0x3003
testl %eax, %eax
je 0x301d
cmpl $0x66, %eax
jne 0x31ea
movq 0x2fda(%rip), %rax      # 0x5fd8
movq (%rax), %rbx
jmp 0x303e
cmpl $0x6c, %eax
jne 0x31c2
movq 0x2fc5(%rip), %rax      # 0x5fd8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x303e
movslq 0xc(%rsp), %rax
shlq $0x5, %rax
movq (%rax,%r15), %rdi
leaq 0x1245(%rip), %rsi      # 0x4276
callq 0x2150
testl %eax, %eax
je 0x31ce
movl %ebp, %edi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
movq %r12, %r8
callq 0x20f0
testl %eax, %eax
jns 0x2fe5
jmp 0x3060
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
jne 0x3200
movq 0x2f5b(%rip), %rax      # 0x5fd0
movslq (%rax), %rax
cmpl %ebp, %eax
je 0x3205
movq (%r14,%rax,8), %rdi
movq %rdi, 0x18(%rsp)
leaq 0x12f4(%rip), %rsi      # 0x4384
leaq 0x1018(%rip), %rdx      # 0x40af
callq 0x2c20
movq %rax, %r14
testq %rax, %rax
jne 0x30cc
callq 0x2050
movl (%rax), %edi
movq 0x18(%rsp), %r8
leaq 0x12d9(%rip), %rsi      # 0x4390
leaq 0x122a(%rip), %rdx      # 0x42e8
leaq 0x12f3(%rip), %rcx      # 0x43b8
xorl %eax, %eax
callq 0x25f8
leaq 0x20(%rsp), %rdx
leaq 0x12f1(%rip), %rsi      # 0x43c9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2070
cmpl $0x1, %eax
jne 0x319c
movq %r14, %rdi
callq 0x20c0
cmpl $0x0, 0x20(%rsp)
je 0x320a
callq 0x2f11
movq 0x18(%rsp), %rdi
leaq 0x1198(%rip), %rsi      # 0x42a7
leaq 0xf99(%rip), %rdx       # 0x40af
callq 0x2c20
movq %rax, %r14
testq %rax, %rax
jne 0x314b
callq 0x2050
movl (%rax), %edi
movq 0x18(%rsp), %r8
leaq 0x117d(%rip), %rsi      # 0x42b3
leaq 0x11ab(%rip), %rdx      # 0x42e8
leaq 0x11b4(%rip), %rcx      # 0x42f8
xorl %eax, %eax
callq 0x25f8
movq 0x30fe(%rip), %r15      # 0x6250
testq %r15, %r15
je 0x31b7
movq (%r15), %r12
movq 0x8(%r12), %rdi
movq %rbx, %rsi
callq 0x2150
testl %eax, %eax
je 0x3171
movq 0x8(%r15), %r15
jmp 0x3152
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq *0x10(%r12)
movq %r14, %rdi
callq 0x20c0
callq 0x2f4b
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x1, %eax
jne 0x320f
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0x3214
callq 0x2335
jmp 0x30eb
movq %r14, %rdi
movq %rbx, %rsi
callq 0x236a
cmpl $0x68, %eax
jne 0x31ea
xorl %edi, %edi
callq 0x3219
leaq 0x10a9(%rip), %rdi      # 0x427e
leaq 0x10b4(%rip), %rsi      # 0x4290
xorl %eax, %eax
callq 0x2100
xorl %edi, %edi
callq 0x2220
leaq 0x1273(%rip), %rdi      # 0x4464
callq 0x2080
movl $0x1, %edi
callq 0x3219
callq 0x3281
callq 0x240a
callq 0x239b
callq 0x23e5
callq 0x23c0