// File: /workspace/github_c_makefile_star2_O2/albertito[P]libjio/libjio/jiofsck.c
// Function: main
int main(int argc, char **argv)
{
	int i, do_cleanup;
	unsigned int flags;
	char *file, *jdir;
	struct jfsck_result res;
	enum jfsck_return rv;



	file = jdir = NULL;
	do_cleanup = 0;

	if (argc < 2) {
		usage();
		return 1;
	}

	for (i = 1; i < argc; i++) {
		if (strcmp("clean=1", argv[i]) == 0) {
			do_cleanup = 1;
		} else if (strncmp("dir=", argv[i], 4) == 0) {
			jdir = argv[i] + 4;
		} else {
			file = argv[i];
		}
	}

	memset(&res, 0, sizeof(res));

	flags = 0;
	if (do_cleanup)
		flags |= J_CLEANUP;

	printf("Checking journal: ");
	fflush(stdout);
	rv = jfsck(file, jdir, &res, flags);

	switch (rv) {
	case J_ESUCCESS:
		printf("done\n");
		break;
	case J_ENOENT:
		printf("No such file or directory\n");
		return 1;
	case J_ENOJOURNAL:
		printf("No journal associated to the file, "
				"or journal empty\n");
		return 1;
	case J_ENOMEM:
		printf("Not enough memory\n");
		return 1;
	case J_ECLEANUP:
		printf("Error cleaning up the journal directory\n");
		return 1;
	case J_EIO:
		printf("I/O error\n");
		perror("  additional information");
		return 1;
	default:
		printf("Unknown result, please report as a bug\n");
		return 1;
	}

	printf("Journal checking results\n");
	printf("------------------------\n\n");

	printf("Total:\t\t %d\n", res.total);
	printf("Invalid:\t %d\n", res.invalid);
	printf("In progress:\t %d\n", res.in_progress);
	printf("Broken:\t\t %d\n", res.broken);
	printf("Corrupt:\t %d\n", res.corrupt);
	printf("Reapplied:\t %d\n", res.reapplied);
	printf("\n");

	if (do_cleanup) {
		printf("The journal has been cleaned up.\n");
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x2, %edi
jge 0x252f
leaq 0x2caa(%rip), %rdi      # 0x51c0
callq 0x20c0
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r15
movl %edi, %ebp
movq $0x0, 0x8(%rsp)
pushq $0x1
popq %r12
xorl %ebx, %ebx
xorl %r14d, %r14d
cmpq %r12, %rbp
je 0x2591
movq (%r15,%r12,8), %r13
leaq 0x2ac6(%rip), %rdi      # 0x501c
movq %r13, %rsi
callq 0x2210
testl %eax, %eax
je 0x2584
leaq 0x2abb(%rip), %rdi      # 0x5024
movq %r13, %rsi
pushq $0x4
popq %rdx
callq 0x2080
leaq 0x4(%r13), %rcx
testl %eax, %eax
cmovneq %r13, %rbx
cmoveq %rcx, %r14
jmp 0x258c
pushq $0x1
popq %rax
movq %rax, 0x8(%rsp)
incq %r12
jmp 0x2546
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
andq $0x0, 0x10(%r15)
movaps %xmm0, (%r15)
xorl %ebp, %ebp
movq 0x8(%rsp), %r12
testl %r12d, %r12d
setne %bpl
leaq 0x2a72(%rip), %rdi      # 0x5029
xorl %eax, %eax
callq 0x2130
movq 0x5a13(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
callq 0x22a0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %ebp, %ecx
callq 0x2708
addl $0x5, %eax
cmpl $0x5, %eax
ja 0x26dd
leaq 0x2a14(%rip), %rcx      # 0x5004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x2ab8(%rip), %rdi      # 0x50b8
jmp 0x2516
leaq 0x2b34(%rip), %rdi      # 0x5140
callq 0x20c0
leaq 0x2b2d(%rip), %rdi      # 0x5145
callq 0x20c0
leaq 0x2b3a(%rip), %rdi      # 0x515e
callq 0x20c0
movl 0x10(%rsp), %esi
leaq 0x2a21(%rip), %rdi      # 0x5055
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2130
movl 0x14(%rsp), %esi
leaq 0x2a1a(%rip), %rdi      # 0x5062
xorl %eax, %eax
callq 0x2130
movl 0x18(%rsp), %esi
leaq 0x2a16(%rip), %rdi      # 0x5070
xorl %eax, %eax
callq 0x2130
movl 0x1c(%rsp), %esi
leaq 0x2a16(%rip), %rdi      # 0x5082
xorl %eax, %eax
callq 0x2130
movl 0x20(%rsp), %esi
leaq 0x2a12(%rip), %rdi      # 0x5090
xorl %eax, %eax
callq 0x2130
movl 0x24(%rsp), %esi
leaq 0x2a0e(%rip), %rdi      # 0x509e
xorl %eax, %eax
callq 0x2130
pushq $0xa
popq %rdi
callq 0x2040
testl %r12d, %r12d
je 0x251e
leaq 0x2ac9(%rip), %rdi      # 0x5178
callq 0x20c0
jmp 0x251e
leaq 0x2a20(%rip), %rdi      # 0x50e0
jmp 0x2516
leaq 0x2a5a(%rip), %rdi      # 0x5126
jmp 0x2516
leaq 0x2a1a(%rip), %rdi      # 0x50f2
jmp 0x2516
leaq 0x2ab5(%rip), %rdi      # 0x5199
jmp 0x2516
leaq 0x29be(%rip), %rdi      # 0x50ae
callq 0x20c0
leaq 0x2940(%rip), %rdi      # 0x503c
callq 0x2330
jmp 0x251b
nop