#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 errno;
int /*<<< orphan*/ free(char *);
char *getenv(char *);
int /*<<< orphan*/ setenv(char *, char *, int);
int strtoimax(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ unsetenv(char *);
int /*<<< orphan*/ xasprintf(char **, char *, int);
void eoutdent(void) {
  char *env = getenv("EINFO_INDENT");
  int amount = 0;
  char *num = NULL;
  int serrno = errno;
  if (!env)
    return;
  errno = 0;
  amount = strtoimax(env, NULL, 0);
  if (errno != 0)
    amount = 0;
  else
    amount -= 2;
  if (amount <= 0)
    unsetenv("EINFO_INDENT");
  else {
    xasprintf(&num, "%08d", amount);
    setenv("EINFO_INDENT", num, 1);
    free(num);
  }
  errno = serrno;
}


x86 assembly (clang, -O0):
<eoutdent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe91(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11a3 <eoutdent+0x43>
jmp    123f <eoutdent+0xdf>
mov    0x2e36(%rip),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtoimax@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e17(%rip),%rax
cmpl   $0x0,(%rax)
je     11de <eoutdent+0x7e>
movl   $0x0,-0xc(%rbp)
jmp    11e7 <eoutdent+0x87>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1202 <eoutdent+0xa2>
lea    0xe08(%rip),%rdi
call   1080 <unsetenv@plt>
jmp    1233 <eoutdent+0xd3>
mov    -0xc(%rbp),%edx
lea    -0x18(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1070 <xasprintf@plt>
mov    -0x18(%rbp),%rsi
lea    0xde0(%rip),%rdi
mov    $0x1,%edx
call   1060 <setenv@plt>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
mov    -0x1c(%rbp),%ecx
mov    0x2da3(%rip),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eoutdent>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1030 <getenv@plt>
movq   $0x0,0x8(%rsp)
test   %rax,%rax
je     11f1 <eoutdent+0x91>
mov    0x2e57(%rip),%rbx
mov    (%rbx),%r14d
movl   $0x0,(%rbx)
xor    %ebp,%ebp
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtoimax@plt>
add    $0xfffffffe,%eax
cmpl   $0x0,(%rbx)
cmovne %ebp,%eax
test   %eax,%eax
jle    11e2 <eoutdent+0x82>
lea    0xe59(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %eax,%edx
call   1070 <xasprintf@plt>
mov    0x8(%rsp),%rsi
lea    0xe34(%rip),%rdi
mov    $0x1,%edx
call   1060 <setenv@plt>
mov    0x8(%rsp),%rdi
call   1040 <free@plt>
jmp    11ee <eoutdent+0x8e>
lea    0xe17(%rip),%rdi
call   1080 <unsetenv@plt>
mov    %r14d,(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"EINFO_INDENT\00"
@errno = global i32 0
@.str.1 = [5 x i8] c"%08d\00"
define void @eoutdent() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %1
store i32 0, i32* %2
store i8* null, i8** %3
%6 = load i32, i32* @errno
store i32 %6, i32* %4
%7 = load i8*, i8** %1
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %0
br label %33
10: ; preds = %0
store i32 0, i32* @errno
%11 = load i8*, i8** %1
%12 = call i32 @strtoimax(i8* %11, i32* null, i32 0)
store i32 %12, i32* %2
%13 = load i32, i32* @errno
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %10
store i32 0, i32* %2
br label %19
16: ; preds = %10
%17 = load i32, i32* %2
%18 = sub nsw i32 %17, 2
store i32 %18, i32* %2
br label %19
19: ; preds = %16, %15
%20 = load i32, i32* %2
%21 = icmp sle i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @unsetenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %31
24: ; preds = %19
%25 = load i32, i32* %2
%26 = call i32 @xasprintf(i8** %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i8*, i8** %3
%28 = call i32 @setenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %27, i32 1)
%29 = load i8*, i8** %3
%30 = call i32 @free(i8* %29)
br label %31
31: ; preds = %24, %22
%32 = load i32, i32* %4
store i32 %32, i32* @errno
br label %33
33: ; preds = %31, %9
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"EINFO_INDENT\00"
@errno = global i32 0
@.str.1 = [5 x i8] c"%08d\00"
define void @eoutdent() {
%1 = alloca i8*
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = load i32, i32* @errno
%5 = icmp eq i8* %2, null
br i1 %5, label %22, label %6
6: ; preds = %0
store i32 0, i32* @errno
%7 = tail call i32 @strtoimax(i8* %2, i32* null, i32 0)
%8 = load i32, i32* @errno
%9 = icmp eq i32 %8, 0
%10 = add nsw i32 %7, -2
%11 = select i1 %9, i32 %10, i32 0
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %6
%14 = tail call i32 @unsetenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %21
15: ; preds = %6
%16 = call i32 @xasprintf(i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%17 = load i8*, i8** %1
%18 = call i32 @setenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %17, i32 1)
%19 = load i8*, i8** %1
%20 = call i32 @free(i8* %19)
br label %21
21: ; preds = %15, %13
store i32 %4, i32* @errno
br label %22
22: ; preds = %0, %21
ret void
}