// File: /workspace/github_cpp_makefile_star2_O3/sanaa-khan[P]mini-linux-shell/gbsh.cpp
// Function: setEnvVar(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
void setEnvVar(vector<string> tokens) {

	char cwd[100];
	getcwd(cwd, 100);

	setenv("SHELL", cwd, 1);

	string name, value;

	if (tokens.size() == 1) {
		cout << "\033[1;31m" << "Error: ";
		cout << "\033[0;38m" << "Name of environment variable not given.\n";
		return;
	}

	name = tokens[1];

	if (tokens.size() == 2)
		value = "";

	else if (tokens.size() == 3)
		value = tokens[2];

	else {
		cout << "\033[1;31m" << "Error: ";
		cout << "\033[0;38m" << "Too many arguments provided.\n";
		return;
	}

	char* var = getenv(name.c_str());

	if (var != NULL)
		cout << "'" << name << "' is already defined.\n";

	else
		setenv(name.c_str(), value.c_str(), 0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movq %rdi, %rbx
leaq 0x40(%rsp), %r14
movl $0x64, %esi
movq %r14, %rdi
callq 0x20a0
leaq 0x1a82(%rip), %rdi      # 0x5069
movq %r14, %rsi
movl $0x1, %edx
callq 0x2270
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
xorl %eax, %eax
movq %rax, -0x8(%r14)
movb %al, (%r14)
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
movq %rax, -0x8(%r15)
movb %al, (%r15)
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
cmpq $0x20, %rax
jne 0x367f
movq 0x399b(%rip), %rdi      # 0x6fc8
leaq 0x1a4d(%rip), %rsi      # 0x5081
movl $0x7, %edx
callq 0x21b0
movq 0x3983(%rip), %rdi      # 0x6fc8
leaq 0x1a3d(%rip), %rsi      # 0x5089
movl $0x7, %edx
callq 0x21b0
movq 0x396b(%rip), %rdi      # 0x6fc8
leaq 0x1a2d(%rip), %rsi      # 0x5091
movl $0x7, %edx
callq 0x21b0
movl $0x28, %edx
leaq 0x1a8a(%rip), %rsi      # 0x5104
jmp 0x377f
addq $0x20, %rsi
movq %rsp, %rdi
callq 0x20c0
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq $0x3, %rax
je 0x36c5
cmpq $0x2, %rax
jne 0x372b
leaq 0x20(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x1a13(%rip), %rcx      # 0x50cc
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x22b0
jmp 0x36d3
addq $0x40, %rsi
leaq 0x20(%rsp), %rdi
callq 0x20c0
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x21f0
testq %rax, %rax
je 0x37c5
movq 0x38d9(%rip), %rdi      # 0x6fc8
leaq 0x1a55(%rip), %rsi      # 0x514b
movl $0x1, %edx
callq 0x21b0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x38b8(%rip), %rdi      # 0x6fc8
callq 0x21b0
leaq 0x1a31(%rip), %rsi      # 0x514d
movl $0x16, %edx
movq %rax, %rdi
callq 0x21b0
jmp 0x378b
movq 0x3896(%rip), %rdi      # 0x6fc8
leaq 0x1948(%rip), %rsi      # 0x5081
movl $0x7, %edx
callq 0x21b0
movq 0x387e(%rip), %rdi      # 0x6fc8
leaq 0x1938(%rip), %rsi      # 0x5089
movl $0x7, %edx
callq 0x21b0
movq 0x3866(%rip), %rdi      # 0x6fc8
leaq 0x1928(%rip), %rsi      # 0x5091
movl $0x7, %edx
callq 0x21b0
movl $0x1d, %edx
leaq 0x19ae(%rip), %rsi      # 0x512d
movq 0x3842(%rip), %rdi      # 0x6fc8
callq 0x21b0
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x37a2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21a0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x37b8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21a0
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x20(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2270
jmp 0x378b
jmp 0x37d8
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x37f2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21a0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x3808
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x22f0