// File: /workspace/github_c_makefile_star2_O2/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
movslq %edi, %rcx
pushq $0x1
popq %rax
xorl %r14d, %r14d
xorl %edx, %edx
cmpq %rcx, %rax
jge 0x1272
testq %r14, %r14
je 0x1269
testq %rdx, %rdx
jne 0x139e
movq (%rsi,%rax,8), %rdx
jmp 0x126d
movq (%rsi,%rax,8), %r14
incq %rax
jmp 0x1250
testq %r14, %r14
je 0x1369
leaq 0x1dca(%rip), %rsi      # 0x304c
movq %r14, %rdi
callq 0x1100
testq %rax, %rax
je 0x137f
movq %rax, %rbx
movq %rax, %rdi
callq 0x273b
leaq 0x4e0f(%rip), %rax      # 0x60b4
leaq 0x4e0c(%rip), %rcx      # 0x60b8
movl (%rcx), %ecx
orl (%rax), %ecx
jne 0x12cd
leaq 0x1df6(%rip), %rdi      # 0x30af
callq 0x1060
movq %rbx, %rdi
callq 0x1080
pushq $0x3
jmp 0x13bc
movq %rbx, %rdi
callq 0x14c4
movq %rbx, %rdi
callq 0x2433
movq %rax, %r14
movq %rax, %rdi
callq 0x19ab
testl %eax, %eax
je 0x135d
leaq 0x1d93(%rip), %rdi      # 0x3086
callq 0x1060
leaq 0x4dc9(%rip), %rax      # 0x60c8
leaq 0x4dce(%rip), %rcx      # 0x60d4
movl (%rcx), %ecx
imull (%rax), %ecx
movq %r14, %rdi
addq %rcx, %rdi
callq 0x19ab
xorl %r15d, %r15d
pushq $0x1
popq %rsi
movq %rsp, %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x1e96
testl %eax, %eax
je 0x133f
movl 0x8(%rsp), %esi
leaq 0x1d33(%rip), %rdi      # 0x306b
xorl %eax, %eax
callq 0x1090
movq %rbx, %rdi
callq 0x1080
movq %r14, %rdi
callq 0x1030
leaq 0x1d3d(%rip), %rdi      # 0x3093
callq 0x1060
jmp 0x13be
movq %r14, %rdi
callq 0x1030
pushq $0x4
jmp 0x13bc
movq 0x4c88(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
movq (%rsi), %rdx
leaq 0x1ca3(%rip), %rsi      # 0x3020
jmp 0x13b3
movq 0x4c72(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1cbf(%rip), %rsi      # 0x304f
movq %r14, %rdx
xorl %eax, %eax
callq 0x10b0
pushq $0x2
jmp 0x13bc
movq 0x4c53(%rip), %rcx      # 0x5ff8
movq (%rcx), %rdi
movq (%rsi,%rax,8), %rdx
leaq 0x1c51(%rip), %rsi      # 0x3004
xorl %eax, %eax
callq 0x10b0
pushq $0x1
popq %r15
movl %r15d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop