// File: /workspace/github_cpp_makefile_star2_O2/UTSASRG[P]Guarder/libguarder.cpp
// Function: parseEnvOpts()
void parseEnvOpts() {
		char * value;

		// opts is a global struct located in bibopheap.hh
		if((value = getenv("GUARDER_NUMERATOR"))) {
				opts.over_prov_numerator = atoi(value);
		}
    if((value = getenv("GUARDER_DENOMINATOR"))) {
        opts.over_prov_denominator = atoi(value);
    }
		// Over provisioning ratio must be greater than or equal to 1
		if((opts.over_prov_denominator <= 0) ||
						(opts.over_prov_numerator < opts.over_prov_denominator)) {
				PRERR("over provisioning ratio invalid; setting to 1/1");
				opts.over_prov_numerator = 1;
				opts.over_prov_denominator = 1;
		}

    if((value = getenv("GUARDER_ENTROPY_BITS"))) {
        opts.bibop_entropy_bits = atoi(value);
    }
		// Entropy bits must be a positive integer
		if(opts.bibop_entropy_bits <= 0) {
				PRERR("invalid bibop entropy bits; setting to default value (%u)",
								DEFAULT_BIBOP_ENTROPY_BITS);
				opts.bibop_entropy_bits = DEFAULT_BIBOP_ENTROPY_BITS;
		}

		opts.bibop_cache_size = (1U << (opts.bibop_entropy_bits + 1));

		/*
    if((value = getenv("GUARDER_CACHE_DIVISOR"))) {
        opts.bibop_cache_allowance_divisor = atoi(value);
    }
		// Cache allowance divisor must be a positive integer >= 2
		if(opts.bibop_cache_allowance_divisor < 2) {
				PRERR("invalid bibop cache allowance divisor; "
								"setting to default value (%u)", DEFAULT_BIBOP_CACHE_ALLOWANCE_DIVISOR);
				opts.bibop_cache_allowance_divisor = DEFAULT_BIBOP_CACHE_ALLOWANCE_DIVISOR;
		}
		*/

    if((value = getenv("GUARDER_RAND_GUARD_PROP"))) {
        opts.random_guard_prop = atof(value);
    }
		// Random guard proportion must be a fraction between [0, 1)
		if((opts.random_guard_prop < 0.0f) || (opts.random_guard_prop >= 1.0f)) {
				PRERR("invalid random guard proportion; "
								"setting to default value (%4.2f)", DEFAULT_RAND_GUARD_PROP);
				opts.random_guard_prop = DEFAULT_RAND_GUARD_PROP;
		}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x4204(%rip), %rdi      # 0x9120
callq 0x43f0
testq %rax, %rax
je 0x4f38
movq %rax, %rdi
callq 0x4530
movq 0x8feb(%rip), %rcx      # 0xdf20
movl %eax, 0xc(%rcx)
leaq 0x41f3(%rip), %rdi      # 0x9132
callq 0x43f0
testq %rax, %rax
je 0x4f5d
movq %rax, %rdi
callq 0x4530
movq 0x8fc8(%rip), %rcx      # 0xdf20
movl %eax, 0x10(%rcx)
jmp 0x4f67
movq 0x8fbc(%rip), %rax      # 0xdf20
movl 0x10(%rax), %eax
movq 0x8fb2(%rip), %r15      # 0xdf20
decl %eax
cmpl 0xc(%r15), %eax
jb 0x4fda
callq 0x4200
movq %rax, %rbx
callq 0x4280
leaq 0x41bc(%rip), %rdx      # 0x9146
leaq 0x4180(%rip), %r8       # 0x9111
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq %rax, %rcx
movl $0xb4, %r9d
xorl %eax, %eax
callq 0x4560
callq 0x4200
movq %rax, %rbx
callq 0x4200
movq %rax, %rdi
callq 0x4130
pushq $0x2
popq %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x4100
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0xc(%r15)
leaq 0x41b9(%rip), %rdi      # 0x919a
callq 0x43f0
testq %rax, %rax
je 0x4ffb
movq %rax, %rdi
callq 0x4530
movl %eax, %ebx
movl %eax, 0x4(%r15)
jmp 0x4fff
movl 0x4(%r15), %ebx
testl %ebx, %ebx
jne 0x5063
callq 0x4200
movq %rax, %r14
callq 0x4280
pushq $0xa
popq %rbx
movl %ebx, (%rsp)
leaq 0x4192(%rip), %rdx      # 0x91af
leaq 0x40ed(%rip), %r8       # 0x9111
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
movq %rax, %rcx
movl $0xbf, %r9d
xorl %eax, %eax
callq 0x4560
callq 0x4200
movq %rax, %r14
callq 0x4200
movq %rax, %rdi
callq 0x4130
pushq $0x2
popq %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4100
movl %ebx, 0x4(%r15)
incb %bl
pushq $0x1
popq %rax
movl %ebx, %ecx
shll %cl, %eax
movl %eax, 0x8(%r15)
leaq 0x4196(%rip), %rdi      # 0x920d
callq 0x43f0
testq %rax, %rax
je 0x5095
movq %rax, %rdi
callq 0x4410
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x14(%r15)
jmp 0x509b
movss 0x14(%r15), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
ja 0x50ac
ucomiss 0x3f9e(%rip), %xmm0     # 0x9048
jb 0x5112
callq 0x4200
movq %rax, %rbx
callq 0x4280
leaq 0x4165(%rip), %rdx      # 0x9225
leaq 0x404a(%rip), %r8       # 0x9111
movsd 0x3f81(%rip), %xmm0     # 0x9050
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq %rax, %rcx
movl $0xd7, %r9d
movb $0x1, %al
callq 0x4560
callq 0x4200
movq %rax, %rbx
callq 0x4200
movq %rax, %rdi
callq 0x4130
pushq $0x2
popq %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x4100
movl $0x3dcccccd, 0x14(%r15) # imm = 0x3DCCCCCD
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq