#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 */
char *add_adress(char *, char *);
char *my_str_add(char *, char *);
int my_str_compar(char *, char *);
char *supr_adress(char *);
char *creat_new_adress(char *str1, char *str2) {
  char *dest;
  if (my_str_compar(str2, "..") == 1)
    dest = supr_adress(str1);
  else if (str2[0] == '/')
    dest = my_str_add("PWD=", str2);
  else
    dest = add_adress(str1, str2);
  return (dest);
}


x86 assembly (clang, -O0):
<creat_new_adress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1040 <my_str_compar@plt>
cmp    $0x1,%eax
jne    117b <creat_new_adress+0x3b>
mov    -0x8(%rbp),%rdi
call   1060 <supr_adress@plt>
mov    %rax,-0x18(%rbp)
jmp    11ba <creat_new_adress+0x7a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    11a4 <creat_new_adress+0x64>
mov    -0x10(%rbp),%rsi
lea    0xe6d(%rip),%rdi
call   1050 <my_str_add@plt>
mov    %rax,-0x18(%rbp)
jmp    11b5 <creat_new_adress+0x75>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <add_adress@plt>
mov    %rax,-0x18(%rbp)
jmp    11ba <creat_new_adress+0x7a>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<creat_new_adress>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <my_str_compar@plt>
cmp    $0x1,%eax
jne    116d <creat_new_adress+0x2d>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <supr_adress@plt>
cmpb   $0x2f,(%rbx)
jne    1188 <creat_new_adress+0x48>
lea    0xe8a(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <my_str_add@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <add_adress@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"..\00"
@.str.1 = [5 x i8] c"PWD=\00"
define i8* @creat_new_adress(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @my_str_compar(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i8* @supr_adress(i8* %10)
store i8* %11, i8** %5
br label %26
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 47
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i8*, i8** %4
%20 = call i8* @my_str_add(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %19)
store i8* %20, i8** %5
br label %25
21: ; preds = %12
%22 = load i8*, i8** %3
%23 = load i8*, i8** %4
%24 = call i8* @add_adress(i8* %22, i8* %23)
store i8* %24, i8** %5
br label %25
25: ; preds = %21, %18
br label %26
26: ; preds = %25, %9
%27 = load i8*, i8** %5
ret i8* %27
}

LLVM IR (-O2):
@.str = [3 x i8] c"..\00"
@.str.1 = [5 x i8] c"PWD=\00"
define i8* @creat_new_adress(i8* %0, i8* %1) {
%3 = tail call i32 @my_str_compar(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i8* @supr_adress(i8* %0)
br label %14
7: ; preds = %2
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, 47
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i8* @my_str_add(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %14
12: ; preds = %7
%13 = tail call i8* @add_adress(i8* %0, i8* %1)
br label %14
14: ; preds = %10, %12, %5
%15 = phi i8* [ %6, %5 ], [ %11, %10 ], [ %13, %12 ]
ret i8* %15
}