#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*/ fprintf(int /*<<< orphan*/, char *, char *);
char *get_string_value(char *);
char *get_working_directory(char *);
int /*<<< orphan*/ sh_xfree(char *, char *, int);
int /*<<< orphan*/ stderr;
void send_pwd_to_eterm() {
  char *pwd, *f;
  f = 0;
  pwd = get_string_value("PWD");
  if (pwd == 0)
    f = pwd = get_working_directory("eterm");
  fprintf(stderr, "\032/%s\n", pwd);
  sh_xfree((f),
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/AlexYursha/shell/refs/heads/dev/eval.c",
           179);
}


x86 assembly (clang, -O0):
<send_pwd_to_eterm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
lea    0xea9(%rip),%rdi
call   1050 <get_string_value@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    117f <send_pwd_to_eterm+0x3f>
lea    0xe92(%rip),%rdi
call   1030 <get_working_directory@plt>
mov    %rax,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe77(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe6d(%rip),%rsi
mov    $0xb3,%edx
call   1060 <sh_xfree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_pwd_to_eterm>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1050 <get_string_value@plt>
test   %rax,%rax
je     1156 <send_pwd_to_eterm+0x16>
xor    %ebx,%ebx
jmp    1165 <send_pwd_to_eterm+0x25>
lea    0xea7(%rip),%rdi
call   1030 <get_working_directory@plt>
mov    %rax,%rbx
mov    0x2e74(%rip),%rcx
mov    (%rcx),%edi
lea    0xe95(%rip),%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
mov    $0xb3,%edx
pop    %rbx
jmp    1060 <sh_xfree@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"PWD\00"
@.str.1 = [6 x i8] c"eterm\00"
@stderr = global i32 0
@.str.2 = [6 x i8] c"\1A/%s\0A\00"
@.str.3 = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AlexYursha/shell/refs/heads/dev/eval.c\00"
define void @send_pwd_to_eterm() {
%1 = alloca i8*
%2 = alloca i8*
store i8* null, i8** %2
%3 = call i8* @get_string_value(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i8* @get_working_directory(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i8* %7, i8** %1
store i8* %7, i8** %2
br label %8
8: ; preds = %6, %0
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %2
%13 = call i32 @sh_xfree(i8* %12, i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str.3, i64 0, i64 0), i32 179)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"PWD\00"
@.str.1 = [6 x i8] c"eterm\00"
@stderr = global i32 0
@.str.2 = [6 x i8] c"\1A/%s\0A\00"
@.str.3 = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AlexYursha/shell/refs/heads/dev/eval.c\00"
define void @send_pwd_to_eterm() {
%1 = tail call i8* @get_string_value(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i8* @get_working_directory(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i8* [ %4, %3 ], [ %1, %0 ]
%7 = phi i8* [ %4, %3 ], [ null, %0 ]
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%10 = tail call i32 @sh_xfree(i8* %7, i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str.3, i64 0, i64 0), i32 179)
ret void
}