#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 */
int atoi(char const *);
char *getenv(char *);
void CNSL_GetGeometry(int *width, int *height) {
  const char *widthenv = getenv("CNSLWIDTH");
  const char *heightenv = getenv("CNSLHEIGHT");
  if (widthenv) {
    *width = atoi(widthenv);
  }
  if (heightenv) {
    *height = atoi(heightenv);
  }
}


x86 assembly (clang, -O0):
<CNSL_GetGeometry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116c <CNSL_GetGeometry+0x4c>
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1188 <CNSL_GetGeometry+0x68>
mov    -0x20(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CNSL_GetGeometry>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xecb(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xec6(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r12
test   %rbx,%rbx
je     115c <CNSL_GetGeometry+0x3c>
mov    %rbx,%rdi
call   1040 <atoi@plt>
mov    %eax,(%r15)
test   %r12,%r12
je     116c <CNSL_GetGeometry+0x4c>
mov    %r12,%rdi
call   1040 <atoi@plt>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"CNSLWIDTH\00"
@.str.1 = [11 x i8] c"CNSLHEIGHT\00"
define void @CNSL_GetGeometry(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %5
%8 = call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 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 %15
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = call i32 @atoi(i8* %12)
%14 = load i32*, i32** %3
store i32 %13, i32* %14
br label %15
15: ; preds = %11, %2
%16 = load i8*, i8** %6
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i8*, i8** %6
%20 = call i32 @atoi(i8* %19)
%21 = load i32*, i32** %4
store i32 %20, i32* %21
br label %22
22: ; preds = %18, %15
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"CNSLWIDTH\00"
@.str.1 = [11 x i8] c"CNSLHEIGHT\00"
define void @CNSL_GetGeometry(i32* nocapture writeonly %0, i32* nocapture writeonly %1) {
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i8* %3, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @atoi(i8* %3)
store i32 %7, i32* %0
br label %8
8: ; preds = %6, %2
%9 = icmp eq i8* %4, null
br i1 %9, label %12, label %10
10: ; preds = %8
%11 = tail call i32 @atoi(i8* %4)
store i32 %11, i32* %1
br label %12
12: ; preds = %10, %8
ret void
}