// File: /workspace/github_cpp_makefile_star2_O3/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 0x412c(%rip), %rdi      # 0x9130
callq 0x4380
testq %rax, %rax
je 0x5020
movq %rax, %rdi
callq 0x4470
movq 0x7f03(%rip), %rcx      # 0xcf20
movl %eax, 0xc(%rcx)
leaq 0x411b(%rip), %rdi      # 0x9142
callq 0x4380
testq %rax, %rax
je 0x5045
movq %rax, %rdi
callq 0x4470
movq 0x7ee0(%rip), %rcx      # 0xcf20
movl %eax, 0x10(%rcx)
jmp 0x504f
movq 0x7ed4(%rip), %rax      # 0xcf20
movl 0x10(%rax), %eax
movq 0x7eca(%rip), %r15      # 0xcf20
decl %eax
cmpl 0xc(%r15), %eax
jb 0x50c4
callq 0x41e0
movq %rax, %rbx
callq 0x4250
leaq 0x40e4(%rip), %rdx      # 0x9156
leaq 0x40a8(%rip), %r8       # 0x9121
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq %rax, %rcx
movl $0xb4, %r9d
xorl %eax, %eax
callq 0x4490
callq 0x41e0
movq %rax, %rbx
callq 0x41e0
movq %rax, %rdi
callq 0x4120
movl $0x2, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x40f0
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0xc(%r15)
leaq 0x40df(%rip), %rdi      # 0x91aa
callq 0x4380
testq %rax, %rax
je 0x50e5
movq %rax, %rdi
callq 0x4470
movl %eax, %ebx
movl %eax, 0x4(%r15)
jmp 0x50e9
movl 0x4(%r15), %ebx
testl %ebx, %ebx
jne 0x5151
callq 0x41e0
movq %rax, %r14
callq 0x4250
movl $0xa, %ebx
movl %ebx, (%rsp)
leaq 0x40b6(%rip), %rdx      # 0x91bf
leaq 0x4011(%rip), %r8       # 0x9121
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
movq %rax, %rcx
movl $0xbf, %r9d
xorl %eax, %eax
callq 0x4490
callq 0x41e0
movq %rax, %r14
callq 0x41e0
movq %rax, %rdi
callq 0x4120
movl $0x2, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x40f0
movl %ebx, 0x4(%r15)
incb %bl
movl $0x1, %eax
movl %ebx, %ecx
shll %cl, %eax
movl %eax, 0x8(%r15)
leaq 0x40b6(%rip), %rdi      # 0x921d
callq 0x4380
testq %rax, %rax
je 0x5185
movq %rax, %rdi
callq 0x4390
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x14(%r15)
jmp 0x518b
movss 0x14(%r15), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
ja 0x519c
ucomiss 0x3eae(%rip), %xmm0     # 0x9048
jb 0x5204
callq 0x41e0
movq %rax, %rbx
callq 0x4250
leaq 0x4085(%rip), %rdx      # 0x9235
leaq 0x3f6a(%rip), %r8       # 0x9121
movsd 0x3e91(%rip), %xmm0     # 0x9050
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq %rax, %rcx
movl $0xd7, %r9d
movb $0x1, %al
callq 0x4490
callq 0x41e0
movq %rax, %rbx
callq 0x41e0
movq %rax, %rdi
callq 0x4120
movl $0x2, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x40f0
movl $0x3dcccccd, 0x14(%r15) # imm = 0x3DCCCCCD
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq