#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*/ EXIT_FAILURE;
scalar_t__ chdir(char *);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ stderr;
char *strerror(int);
void change_dir(void) {
  if (chdir("..") < 0) {
    fprintf(stderr, "Err.:(%d) - %s: \"..\"\n", errno, strerror(errno));
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<change_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <chdir@plt>
cmp    $0x0,%rax
jge    11a7 <change_dir+0x67>
mov    0x2e7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e67(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%edx
mov    %rax,%rcx
lea    0xe6f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<change_dir>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
call   1030 <chdir@plt>
test   %rax,%rax
js     115b <change_dir+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e7e(%rip),%rax
mov    (%rax),%ebx
mov    0x2e6d(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1060 <strerror@plt>
lea    0xe88(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %rax,%rcx
call   1040 <fprintf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"..\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Err.:(%d) - %s: \22..\22\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @change_dir() {
%1 = call i64 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %11
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = load i32, i32* @errno
%6 = load i32, i32* @errno
%7 = call i8* @strerror(i32 %6)
%8 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"..\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Err.:(%d) - %s: \22..\22\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @change_dir() {
%1 = tail call i64 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %10
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = load i32, i32* @errno
%6 = tail call i8* @strerror(i32 %5)
%7 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
ret void
}