#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
char *getenv(char *);
int strtoul(char *, int /*<<< orphan*/ *, int);
void getiomax(size_t *imax, size_t *omax) {
  char *env_imax = getenv("GZMULTI_IMAX");
  char *env_omax = getenv("GZMULTI_OMAX");
  *imax = env_imax ? strtoul(env_imax, NULL, 10) : (4 * 1024);
  *omax = env_omax ? strtoul(env_omax, NULL, 10) : (8 * 1024);
  *imax = *imax ? *imax : (4 * 1024);
  *omax = *omax ? *omax : (8 * 1024);
}


x86 assembly (clang, -O0):
<getiomax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1175 <getiomax+0x55>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %eax,-0x24(%rbp)
jmp    1182 <getiomax+0x62>
mov    $0x1000,%eax
mov    %eax,-0x24(%rbp)
jmp    1182 <getiomax+0x62>
mov    -0x24(%rbp),%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     11b4 <getiomax+0x94>
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %eax,-0x28(%rbp)
jmp    11c1 <getiomax+0xa1>
mov    $0x2000,%eax
mov    %eax,-0x28(%rbp)
jmp    11c1 <getiomax+0xa1>
mov    -0x28(%rbp),%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     11ec <getiomax+0xcc>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    11fa <getiomax+0xda>
mov    $0x1000,%eax
mov    %rax,-0x30(%rbp)
jmp    11fa <getiomax+0xda>
mov    -0x30(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1223 <getiomax+0x103>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1231 <getiomax+0x111>
mov    $0x2000,%eax
mov    %rax,-0x38(%rbp)
jmp    1231 <getiomax+0x111>
mov    -0x38(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getiomax>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xecb(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xec9(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r15
test   %rbx,%rbx
je     1164 <getiomax+0x44>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
cltq
jmp    1169 <getiomax+0x49>
mov    $0x1000,%eax
mov    %rax,(%r12)
mov    $0x2000,%ebx
mov    $0x2000,%eax
test   %r15,%r15
je     118d <getiomax+0x6d>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
cltq
mov    %rax,(%r14)
mov    (%r12),%rax
test   %rax,%rax
mov    $0x1000,%ecx
cmovne %rax,%rcx
mov    %rcx,(%r12)
mov    (%r14),%rax
test   %rax,%rax
cmovne %rax,%rbx
mov    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"GZMULTI_IMAX\00"
@.str.1 = [13 x i8] c"GZMULTI_OMAX\00"
define void @getiomax(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i8*
%6 = alloca i8*
store i64* %0, i64** %3
store i64* %1, i64** %4
%7 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %5
%8 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = call i32 @strtoul(i8* %12, i32* null, i32 10)
br label %15
14: ; preds = %2
br label %15
15: ; preds = %14, %11
%16 = phi i32 [ %13, %11 ], [ 4096, %14 ]
%17 = sext i32 %16 to i64
%18 = load i64*, i64** %3
store i64 %17, i64* %18
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i8*, i8** %6
%23 = call i32 @strtoul(i8* %22, i32* null, i32 10)
br label %25
24: ; preds = %15
br label %25
25: ; preds = %24, %21
%26 = phi i32 [ %23, %21 ], [ 8192, %24 ]
%27 = sext i32 %26 to i64
%28 = load i64*, i64** %4
store i64 %27, i64* %28
%29 = load i64*, i64** %3
%30 = load i64, i64* %29
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %25
%33 = load i64*, i64** %3
%34 = load i64, i64* %33
br label %36
35: ; preds = %25
br label %36
36: ; preds = %35, %32
%37 = phi i64 [ %34, %32 ], [ 4096, %35 ]
%38 = load i64*, i64** %3
store i64 %37, i64* %38
%39 = load i64*, i64** %4
%40 = load i64, i64* %39
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %36
%43 = load i64*, i64** %4
%44 = load i64, i64* %43
br label %46
45: ; preds = %36
br label %46
46: ; preds = %45, %42
%47 = phi i64 [ %44, %42 ], [ 8192, %45 ]
%48 = load i64*, i64** %4
store i64 %47, i64* %48
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"GZMULTI_IMAX\00"
@.str.1 = [13 x i8] c"GZMULTI_OMAX\00"
define void @getiomax(i64* nocapture %0, i64* nocapture %1) {
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i8* %3, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @strtoul(i8* nocapture %3, i32* null, i32 10)
%8 = sext i32 %7 to i64
br label %9
9: ; preds = %2, %6
%10 = phi i64 [ %8, %6 ], [ 4096, %2 ]
store i64 %10, i64* %0
%11 = icmp eq i8* %4, null
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call i32 @strtoul(i8* nocapture %4, i32* null, i32 10)
%14 = sext i32 %13 to i64
br label %15
15: ; preds = %9, %12
%16 = phi i64 [ %14, %12 ], [ 8192, %9 ]
store i64 %16, i64* %1
%17 = load i64, i64* %0
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i64 4096, i64 %17
store i64 %19, i64* %0
%20 = load i64, i64* %1
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i64 8192, i64 %20
store i64 %22, i64* %1
ret void
}