#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*/ memcpy(char *, char const *, int);
scalar_t__ safe_malloc(char *, int, int);
int strlen(char const *);
char *dfcaten3(const char *x, const char *y, const char *z) {
  int nx, ny, nz, n;
  char *res;
  nx = strlen(x);
  ny = strlen(y);
  nz = strlen(z);
  n = nx + ny + nz;
  res = (char *)safe_malloc(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/rc0/spill/refs/heads/master/spill.c",
      101, sizeof(char) * (n + 3));
  if (nx > 0)
    memcpy(res, x, nx);
  res[nx] = '/';
  if (ny > 0)
    memcpy(res + nx + 1, y, ny);
  res[nx + ny + 1] = '/';
  if (nz > 0)
    memcpy(res + nx + ny + 2, z, nz);
  res[nx + ny + nz + 2] = 0;
  return res;
}


x86 assembly (clang, -O0):
<dfcaten3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x3,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edx
lea    0xe77(%rip),%rdi
mov    $0x65,%esi
call   1030 <safe_malloc@plt>
mov    %rax,-0x30(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    11b1 <dfcaten3+0x81>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
cmpl   $0x0,-0x20(%rbp)
jle    11e2 <dfcaten3+0xb2>
mov    -0x30(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x2f,(%rax,%rcx,1)
cmpl   $0x0,-0x24(%rbp)
jle    1222 <dfcaten3+0xf2>
mov    -0x30(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
movslq -0x20(%rbp),%rax
add    %rax,%rdi
add    $0x2,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
add    -0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dfcaten3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,(%rsp)
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    %rbp,0x8(%rsp)
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    %rbx,0x10(%rsp)
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r13d
lea    (%r15,%r12,1),%r14d
lea    (%r14,%r13,1),%edx
add    $0x3,%edx
lea    0xe7e(%rip),%rdi
mov    $0x65,%esi
call   1030 <safe_malloc@plt>
mov    %rax,%rbp
mov    %rax,%rbx
test   %r12d,%r12d
jle    11a6 <dfcaten3+0x76>
mov    %rbx,%rdi
mov    (%rsp),%rsi
mov    %r12d,%edx
call   1050 <memcpy@plt>
movslq %r12d,%rax
add    %rax,%rbp
movb   $0x2f,(%rbx,%rax,1)
test   %r15d,%r15d
jle    11c6 <dfcaten3+0x96>
lea    0x1(%rbp),%rdi
mov    0x8(%rsp),%rsi
mov    %r15d,%edx
call   1050 <memcpy@plt>
movslq %r14d,%rax
add    %r13d,%r14d
movb   $0x2f,0x1(%rax,%rbx,1)
test   %r13d,%r13d
jle    11ee <dfcaten3+0xbe>
movslq %r15d,%rax
lea    (%rax,%rbp,1),%rdi
add    $0x2,%rdi
mov    0x10(%rsp),%rsi
mov    %r13d,%edx
call   1050 <memcpy@plt>
movslq %r14d,%rax
movb   $0x0,0x2(%rax,%rbx,1)
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [126 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rc0/spill/refs/heads/master/spill.c\00"
define i8* @dfcaten3(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %7
%14 = load i8*, i8** %5
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %8
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
store i32 %17, i32* %9
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = add nsw i32 %18, %19
%21 = load i32, i32* %9
%22 = add nsw i32 %20, %21
store i32 %22, i32* %10
%23 = load i32, i32* %10
%24 = add nsw i32 %23, 3
%25 = sext i32 %24 to i64
%26 = mul i64 1, %25
%27 = trunc i64 %26 to i32
%28 = call i64 @safe_malloc(i8* getelementptr inbounds ([126 x i8], [126 x i8]* @.str, i64 0, i64 0), i32 101, i32 %27)
%29 = inttoptr i64 %28 to i8*
store i8* %29, i8** %11
%30 = load i32, i32* %7
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %3
%33 = load i8*, i8** %11
%34 = load i8*, i8** %4
%35 = load i32, i32* %7
%36 = call i32 @memcpy(i8* %33, i8* %34, i32 %35)
br label %37
37: ; preds = %32, %3
%38 = load i8*, i8** %11
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
store i8 47, i8* %41
%42 = load i32, i32* %8
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %53
44: ; preds = %37
%45 = load i8*, i8** %11
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = getelementptr inbounds i8, i8* %48, i64 1
%50 = load i8*, i8** %5
%51 = load i32, i32* %8
%52 = call i32 @memcpy(i8* %49, i8* %50, i32 %51)
br label %53
53: ; preds = %44, %37
%54 = load i8*, i8** %11
%55 = load i32, i32* %7
%56 = load i32, i32* %8
%57 = add nsw i32 %55, %56
%58 = add nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %54, i64 %59
store i8 47, i8* %60
%61 = load i32, i32* %9
%62 = icmp sgt i32 %61, 0
br i1 %62, label %63, label %75
63: ; preds = %53
%64 = load i8*, i8** %11
%65 = load i32, i32* %7
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %64, i64 %66
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %67, i64 %69
%71 = getelementptr inbounds i8, i8* %70, i64 2
%72 = load i8*, i8** %6
%73 = load i32, i32* %9
%74 = call i32 @memcpy(i8* %71, i8* %72, i32 %73)
br label %75
75: ; preds = %63, %53
%76 = load i8*, i8** %11
%77 = load i32, i32* %7
%78 = load i32, i32* %8
%79 = add nsw i32 %77, %78
%80 = load i32, i32* %9
%81 = add nsw i32 %79, %80
%82 = add nsw i32 %81, 2
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %76, i64 %83
store i8 0, i8* %84
%85 = load i8*, i8** %11
ret i8* %85
}

LLVM IR (-O2):
@.str = [126 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rc0/spill/refs/heads/master/spill.c\00"
define i8* @dfcaten3(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @strlen(i8* %2)
%7 = add nsw i32 %5, %4
%8 = add nsw i32 %7, %6
%9 = add nsw i32 %8, 3
%10 = tail call i64 @safe_malloc(i8* getelementptr inbounds ([126 x i8], [126 x i8]* @.str, i64 0, i64 0), i32 101, i32 %9)
%11 = inttoptr i64 %10 to i8*
%12 = icmp sgt i32 %4, 0
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = tail call i32 @memcpy(i8* %11, i8* %0, i32 %4)
br label %15
15: ; preds = %13, %3
%16 = sext i32 %4 to i64
%17 = getelementptr inbounds i8, i8* %11, i64 %16
store i8 47, i8* %17
%18 = icmp sgt i32 %5, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = getelementptr inbounds i8, i8* %17, i64 1
%21 = tail call i32 @memcpy(i8* %20, i8* %1, i32 %5)
br label %22
22: ; preds = %19, %15
%23 = add nsw i32 %7, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %11, i64 %24
store i8 47, i8* %25
%26 = icmp sgt i32 %6, 0
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = sext i32 %5 to i64
%29 = getelementptr inbounds i8, i8* %17, i64 %28
%30 = getelementptr inbounds i8, i8* %29, i64 2
%31 = tail call i32 @memcpy(i8* %30, i8* %2, i32 %6)
br label %32
32: ; preds = %27, %22
%33 = add nsw i32 %8, 2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %11, i64 %34
store i8 0, i8* %35
ret i8* %11
}