#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 /*<<< orphan*/ atoi(int /*<<< orphan*/ *);
int /*<<< orphan*/ close(int /*<<< orphan*/);
int /*<<< orphan*/ *getenv(char *);
void disposeSharedComm(void) {
  if (getenv("fd_in") != NULL)
    close(atoi(getenv("fd_in")));
  if (getenv("fd_out") != NULL)
    close(atoi(getenv("fd_out")));
}


x86 assembly (clang, -O0):
<disposeSharedComm>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1165 <disposeSharedComm+0x35>
lea    0xeaf(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <close@plt>
lea    0xe9a(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1196 <disposeSharedComm+0x66>
lea    0xe84(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <close@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<disposeSharedComm>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1151 <disposeSharedComm+0x21>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <close@plt>
lea    0xeae(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1172 <disposeSharedComm+0x42>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <close@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"fd_in\00"
@.str.1 = [7 x i8] c"fd_out\00"
define void @disposeSharedComm() {
%1 = call i32* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i32* %1, null
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = call i32* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @atoi(i32* %4)
%6 = call i32 @close(i32 %5)
br label %7
7: ; preds = %3, %0
%8 = call i32* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = call i32* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @atoi(i32* %11)
%13 = call i32 @close(i32 %12)
br label %14
14: ; preds = %10, %7
ret void
}

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