#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*/ free(char *);
char *get_current_dir_name();
char *slurm_xmalloc(int, char *, int, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int strlen(char *);
extern char *make_full_path(char *rpath) {
  char *cwd;
  char *cwd2;
  int len;
  cwd = get_current_dir_name();
  len = strlen(cwd) + strlen(rpath) + 2;
  cwd2 =
      slurm_xmalloc(len,
                    "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/Q-Leap-Networks/"
                    "debian-slurm/refs/heads/master/src/common/util-net.c",
                    401, "");
  sprintf(cwd2, "%s/%s", cwd, rpath);
  free(cwd);
  return cwd2;
}


x86 assembly (clang, -O0):
<make_full_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1060 <get_current_dir_name@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
lea    0xe6d(%rip),%rsi
mov    $0x191,%edx
lea    0xeff(%rip),%rcx
call   1050 <slurm_xmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xee4(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_full_path>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1060 <get_current_dir_name@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%edi
add    $0x2,%edi
lea    0xe7a(%rip),%rsi
lea    0xf11(%rip),%rcx
mov    $0x191,%edx
call   1050 <slurm_xmalloc@plt>
mov    %rax,%rbx
lea    0xefe(%rip),%rsi
mov    %rax,%rdi
mov    %r12,%rdx
mov    %r14,%rcx
call   1070 <sprintf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [159 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Q-Leap-Networks/debian-slurm/refs/heads/master/src/common/util-net.c\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [6 x i8] c"%s/%s\00"
define i8* @make_full_path(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %2
%6 = call i8* (...) @get_current_dir_name()
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %8, %10
%12 = add nsw i32 %11, 2
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i8* @slurm_xmalloc(i32 %13, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i32 401, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i8* %14, i8** %4
%15 = load i8*, i8** %4
%16 = load i8*, i8** %3
%17 = load i8*, i8** %2
%18 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i8*, i8** %3
%20 = call i32 @free(i8* %19)
%21 = load i8*, i8** %4
ret i8* %21
}

LLVM IR (-O2):
@.str = [159 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Q-Leap-Networks/debian-slurm/refs/heads/master/src/common/util-net.c\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [6 x i8] c"%s/%s\00"
define i8* @make_full_path(i8* %0) {
%2 = tail call i8* (...) @get_current_dir_name()
%3 = tail call i32 @strlen(i8* %2)
%4 = tail call i32 @strlen(i8* %0)
%5 = add i32 %3, 2
%6 = add i32 %5, %4
%7 = tail call i8* @slurm_xmalloc(i32 %6, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i32 401, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @sprintf(i8* dereferenceable(1) %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %2, i8* %0)
%9 = tail call i32 @free(i8* %2)
ret i8* %7
}