// File: /workspace/github_c_makefile_star2_O3/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 0x157b
movl %edi, %ecx
movl $0x1, %eax
xorl %edx, %edx
xorl %r14d, %r14d
testq %r14, %r14
je 0x146e
testq %rdx, %rdx
jne 0x15a8
movq (%rsi,%rax,8), %rdx
jmp 0x1472
movq (%rsi,%rax,8), %r14
incq %rax
cmpq %rax, %rcx
jne 0x145a
testq %r14, %r14
je 0x157b
leaq 0x1bc2(%rip), %rsi      # 0x304c
movq %r14, %rdi
callq 0x1100
testq %rax, %rax
je 0x1585
movq %rax, %rbx
movq %rax, %rdi
callq 0x27e9
leaq 0x4c07(%rip), %rax      # 0x60b4
leaq 0x4c04(%rip), %rcx      # 0x60b8
movl (%rcx), %ecx
orl (%rax), %ecx
jne 0x14d9
leaq 0x1bee(%rip), %rdi      # 0x30af
callq 0x1060
movq %rbx, %rdi
callq 0x1080
movl $0x3, %r15d
jmp 0x15ca
movq %rbx, %rdi
callq 0x16f5
movq %rbx, %rdi
callq 0x25a4
movq %rax, %r14
movq %rax, %rdi
callq 0x1b7d
testl %eax, %eax
je 0x156b
leaq 0x1b87(%rip), %rdi      # 0x3086
callq 0x1060
leaq 0x4bbd(%rip), %rax      # 0x60c8
leaq 0x4bc2(%rip), %rcx      # 0x60d4
movl (%rcx), %ecx
imull (%rax), %ecx
movq %r14, %rdi
addq %rcx, %rdi
callq 0x1b7d
xorl %r15d, %r15d
movq %rsp, %rcx
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2035
testl %eax, %eax
je 0x154d
movl 0x8(%rsp), %esi
leaq 0x1b25(%rip), %rdi      # 0x306b
xorl %eax, %eax
callq 0x1090
movq %rbx, %rdi
callq 0x1080
movq %r14, %rdi
callq 0x1030
leaq 0x1b2f(%rip), %rdi      # 0x3093
callq 0x1060
jmp 0x15ca
movq %r14, %rdi
callq 0x1030
movl $0x4, %r15d
jmp 0x15ca
movq %rsi, %rdi
callq 0x1150
jmp 0x15c4
movq 0x4a6c(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1ab9(%rip), %rsi      # 0x304f
movq %r14, %rdx
xorl %eax, %eax
callq 0x10b0
movl $0x2, %r15d
jmp 0x15ca
movq 0x4a49(%rip), %rcx      # 0x5ff8
movq (%rcx), %rdi
movq (%rsi,%rax,8), %rdx
leaq 0x1a47(%rip), %rsi      # 0x3004
xorl %eax, %eax
callq 0x10b0
movl $0x1, %r15d
movl %r15d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop