// File: /workspace/github_c_makefile_star2_O1/miniupnp[P]hfsplustools/src/hfsrename.c
// Function: main
int main(int argc, char * * argv)
{
	FILE * f;
	const char * isofile = NULL;
	const char * newname = NULL;
	int i;
	unsigned char * catalog = NULL;
	struct find_infos infos;

	for(i = 1; i < argc; i++) {
		if(isofile == NULL)
			isofile = argv[i];
		else if(newname == NULL)
			newname = argv[i];
		else {
			fprintf(stderr, "unrecognized argument : %s\n", argv[i]);
			return 1;
		}
	}
	if(isofile == NULL) {
		fprintf(stderr, "Usage: %s [] <image.iso> [new volume name]\n", argv[0]);
		return 1;
	}
	f = fopen(isofile, "rb");
	if(f == NULL) {
		fprintf(stderr, "cannot open %s for reading\n", isofile);
		return 2;
	}
	read_partition_map(f);
	if(hfs_part_sector == 0 && hfs_part_sector_count == 0) {
		printf("HFS/HFS+ partition not found\n");
		fclose(f);
		return 3;
	} else {
		read_hfs_volume_header(f);
		catalog = load_catalog(f);
		if(!print_node(catalog)) { /* header node */
			free(catalog);
			return 4;
		}
		/* root node */
		printf("\nroot node :\n");
		print_node(catalog + catalog_root_node * catalog_node_size);
		if(hfs_find(catalog, 1, NULL, &infos)) {
			printf("Root Folder found : id=%u\n", infos.folder_id);
			//
		}
	}
	fclose(f);
	free(catalog);
	printf("\n! Warning : Does nothing !\n");
	/* this program is not finished ! */
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpl $0x2, %edi
jl 0x1478
movl %edi, %ecx
movl $0x1, %eax
xorl %edx, %edx
xorl %r14d, %r14d
testq %r14, %r14
je 0x146a
testq %rdx, %rdx
jne 0x15a9
movq (%rsi,%rax,8), %rdx
jmp 0x146e
movq (%rsi,%rax,8), %r14
incq %rax
cmpq %rax, %rcx
jne 0x1456
jmp 0x147b
xorl %r14d, %r14d
testq %r14, %r14
je 0x157c
leaq 0x1bc1(%rip), %rsi      # 0x304c
movq %r14, %rdi
callq 0x1100
testq %rax, %rax
je 0x1586
movq %rax, %rbx
movq %rax, %rdi
callq 0x2837
leaq 0x4c06(%rip), %rax      # 0x60b4
leaq 0x4c03(%rip), %rcx      # 0x60b8
movl (%rcx), %ecx
orl (%rax), %ecx
jne 0x14da
leaq 0x1bed(%rip), %rdi      # 0x30af
callq 0x1060
movq %rbx, %rdi
callq 0x1080
movl $0x3, %r15d
jmp 0x15cb
movq %rbx, %rdi
callq 0x1708
movq %rbx, %rdi
callq 0x25fd
movq %rax, %r14
movq %rax, %rdi
callq 0x1b8f
testl %eax, %eax
je 0x156c
leaq 0x1b86(%rip), %rdi      # 0x3086
callq 0x1060
leaq 0x4bbc(%rip), %rax      # 0x60c8
leaq 0x4bc1(%rip), %rcx      # 0x60d4
movl (%rcx), %ecx
imull (%rax), %ecx
movq %r14, %rdi
addq %rcx, %rdi
callq 0x1b8f
xorl %r15d, %r15d
movq %rsp, %rcx
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2051
testl %eax, %eax
je 0x154e
movl 0x8(%rsp), %esi
leaq 0x1b24(%rip), %rdi      # 0x306b
xorl %eax, %eax
callq 0x1090
movq %rbx, %rdi
callq 0x1080
movq %r14, %rdi
callq 0x1030
leaq 0x1b2e(%rip), %rdi      # 0x3093
callq 0x1060
jmp 0x15cb
movq %r14, %rdi
callq 0x1030
movl $0x4, %r15d
jmp 0x15cb
movq %rsi, %rdi
callq 0x1150
jmp 0x15c5
movq 0x4a6b(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1ab8(%rip), %rsi      # 0x304f
movq %r14, %rdx
xorl %eax, %eax
callq 0x10b0
movl $0x2, %r15d
jmp 0x15cb
movq 0x4a48(%rip), %rcx      # 0x5ff8
movq (%rcx), %rdi
movq (%rsi,%rax,8), %rdx
leaq 0x1a46(%rip), %rsi      # 0x3004
xorl %eax, %eax
callq 0x10b0
movl $0x1, %r15d
movl %r15d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq