// File: /workspace/github_c_makefile_star2_O1/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 0x2581
leaq 0x2c5a(%rip), %rdi      # 0x51c0
callq 0x20c0
movl $0x1, %ebx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r15
movl %edi, %r13d
xorl %ebx, %ebx
movl $0x1, %r12d
xorl %r14d, %r14d
movl $0x0, 0xc(%rsp)
movq (%r15,%r12,8), %rbp
leaq 0x2a77(%rip), %rdi      # 0x501c
movq %rbp, %rsi
callq 0x2210
testl %eax, %eax
je 0x25d5
movl $0x4, %edx
leaq 0x2a67(%rip), %rdi      # 0x5024
movq %rbp, %rsi
callq 0x2080
leaq 0x4(%rbp), %rcx
testl %eax, %eax
cmovneq %rbp, %r14
cmoveq %rcx, %rbx
jmp 0x25dd
movl $0x1, 0xc(%rsp)
incq %r12
cmpq %r12, %r13
jne 0x259a
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
xorl %ebp, %ebp
movl 0xc(%rsp), %r12d
testl %r12d, %r12d
setne %bpl
leaq 0x2a1b(%rip), %rdi      # 0x5029
xorl %eax, %eax
callq 0x2130
movq 0x59bc(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
callq 0x22a0
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %ebp, %ecx
callq 0x274c
addl $0x5, %eax
cmpl $0x5, %eax
ja 0x2736
leaq 0x29bd(%rip), %rcx      # 0x5004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x2a61(%rip), %rdi      # 0x50b8
jmp 0x2566
leaq 0x2add(%rip), %rdi      # 0x5140
callq 0x20c0
leaq 0x2ad6(%rip), %rdi      # 0x5145
callq 0x20c0
leaq 0x2ae3(%rip), %rdi      # 0x515e
callq 0x20c0
movl 0x10(%rsp), %esi
leaq 0x29ca(%rip), %rdi      # 0x5055
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2130
movl 0x14(%rsp), %esi
leaq 0x29c3(%rip), %rdi      # 0x5062
xorl %eax, %eax
callq 0x2130
movl 0x18(%rsp), %esi
leaq 0x29bf(%rip), %rdi      # 0x5070
xorl %eax, %eax
callq 0x2130
movl 0x1c(%rsp), %esi
leaq 0x29bf(%rip), %rdi      # 0x5082
xorl %eax, %eax
callq 0x2130
movl 0x20(%rsp), %esi
leaq 0x29bb(%rip), %rdi      # 0x5090
xorl %eax, %eax
callq 0x2130
movl 0x24(%rsp), %esi
leaq 0x29b7(%rip), %rdi      # 0x509e
xorl %eax, %eax
callq 0x2130
movl $0xa, %edi
callq 0x2040
testl %r12d, %r12d
je 0x2570
leaq 0x2a70(%rip), %rdi      # 0x5178
callq 0x20c0
jmp 0x2570
leaq 0x29c7(%rip), %rdi      # 0x50e0
jmp 0x2566
leaq 0x2a01(%rip), %rdi      # 0x5126
jmp 0x2566
leaq 0x29c1(%rip), %rdi      # 0x50f2
jmp 0x2566
leaq 0x2a5c(%rip), %rdi      # 0x5199
jmp 0x2566
callq 0x2410
jmp 0x256b