// File: /workspace/github_c_makefile_star2_O0/dasJ[P]sd-zfs/src/zfs-generator.c
// Function: getRootOptions
int getRootOptions(char **options) {
	char *optionsval;
	int ret;
	char rw;
	size_t len;

	ret = cmdline_getParam("rootflags=", &optionsval);
	if (ret < 0) {
		fprintf(stderr, "Could not get rootflags= parameter. Error %d\n", ret);
		return 1;
	} else if (ret == 1) {
		// No rootflags specified, go with zfsutil
		optionsval = malloc((strlen("zfsutil") + 1) * sizeof(char));
		strcpy(optionsval, "zfsutil");
	} else if (ret != 0) {
		fprintf(stderr, "Unknown thing happened while reading the rootflags= paramter\n");
		return 2;
	}
	len = strlen(optionsval) + 1;
	// Do we already have zfsutil?
	if (strstr(optionsval, "zfsutil") == NULL) {
		len += strlen(",zfsutil");
	}
	// Do we need to switch to ro?
	ret = cmdline_getSwitch("rw", &rw);
	if (ret != 0) {
		fprintf(stderr, "Could not get rw parameter");
	} else if (rw != 1) {
		len += strlen(",ro");
	}
	// Allocate and fill
	*options = malloc(len * sizeof(char));
	strcpy(*options, optionsval);
	if (strstr(optionsval, "zfsutil") == NULL) {
		strcat(*options, ",zfsutil");
	}
	if (rw != 1) {
		strcat(*options, ",ro");
	}
	free(optionsval);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x9b961(%rip), %rdi     # 0x49d004
leaq -0x18(%rbp), %rsi
callq 0x402760
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x4016dc
movq $0x4cd6e8, %rax         # imm = 0x4CD6E8
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x9b946(%rip), %rsi     # 0x49d00f
movb $0x0, %al
callq 0x40c7a0
movl $0x1, -0x4(%rbp)
jmp 0x401829
cmpl $0x1, -0x1c(%rbp)
jne 0x401702
movl $0x8, %edi
callq 0x421010
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x9b99f(%rip), %rsi     # 0x49d09a
callq 0x401020
jmp 0x40172e
cmpl $0x0, -0x1c(%rbp)
je 0x40172c
movq $0x4cd6e8, %rax         # imm = 0x4CD6E8
movq (%rax), %rdi
leaq 0x9b924(%rip), %rsi     # 0x49d03d
movb $0x0, %al
callq 0x40c7a0
movl $0x2, -0x4(%rbp)
jmp 0x401829
jmp 0x40172e
jmp 0x401730
movq -0x18(%rbp), %rdi
callq 0x4010d8
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x9b94e(%rip), %rsi     # 0x49d09a
callq 0x401078
cmpq $0x0, %rax
jne 0x401763
movq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
leaq 0x9b911(%rip), %rdi     # 0x49d07b
leaq -0x1d(%rbp), %rsi
callq 0x402880
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x401796
movq $0x4cd6e8, %rax         # imm = 0x4CD6E8
movq (%rax), %rdi
leaq 0x9b8f1(%rip), %rsi     # 0x49d07e
movb $0x0, %al
callq 0x40c7a0
jmp 0x4017ad
movsbl -0x1d(%rbp), %eax
cmpl $0x1, %eax
je 0x4017ab
movq -0x28(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x28(%rbp)
jmp 0x4017ad
movq -0x28(%rbp), %rdi
shlq $0x0, %rdi
callq 0x421010
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x401020
movq -0x18(%rbp), %rdi
leaq 0x9b8bb(%rip), %rsi     # 0x49d09a
callq 0x401078
cmpq $0x0, %rax
jne 0x4017fd
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x9b8a1(%rip), %rsi     # 0x49d099
callq 0x401058
movsbl -0x1d(%rbp), %eax
cmpl $0x1, %eax
je 0x401819
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x9b88e(%rip), %rsi     # 0x49d0a2
callq 0x401058
movq -0x18(%rbp), %rdi
callq 0x421350
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)