#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ prepara_string(char **);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void prepara_saida(char **caminho, char **solicitacoes, char **saida) {
  char *temp = NULL;
  *caminho = (char *)malloc((strlen(*solicitacoes) + 1) * sizeof(char));
  strcpy(*caminho, *solicitacoes);
  prepara_string(caminho);
  temp = (char *)malloc((strlen(*caminho) + 1) * sizeof(char));
  strcpy(temp, *caminho);
  *caminho = (char *)malloc((strlen(temp) + strlen(*saida) + 2) * sizeof(char));
  sprintf(*caminho, "%s/%s", *saida, temp);
}


x86 assembly (clang, -O0):
<prepara_saida>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
call   1060 <prepara_string@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
add    $0x2,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x20(%rbp),%rcx
lea    0xdd0(%rip),%rsi
call   1070 <sprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepara_saida>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rsi),%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,(%r15)
mov    (%rbx),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %r15,%rdi
call   1060 <prepara_string@plt>
mov    (%r15),%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    (%r15),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    (%r14),%rdi
call   1040 <strlen@plt>
lea    (%r12,%rax,1),%edi
add    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,(%r15)
mov    (%r14),%rdx
lea    0xe2f(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1070 <sprintf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
define void @prepara_saida(i8** %0, i8** %1, i8** %2) {
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8*
store i8** %0, i8*** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
store i8* null, i8** %7
%8 = load i8**, i8*** %5
%9 = load i8*, i8** %8
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 1
%14 = trunc i64 %13 to i32
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i8*
%17 = load i8**, i8*** %4
store i8* %16, i8** %17
%18 = load i8**, i8*** %4
%19 = load i8*, i8** %18
%20 = load i8**, i8*** %5
%21 = load i8*, i8** %20
%22 = call i32 @strcpy(i8* %19, i8* %21)
%23 = load i8**, i8*** %4
%24 = call i32 @prepara_string(i8** %23)
%25 = load i8**, i8*** %4
%26 = load i8*, i8** %25
%27 = call i32 @strlen(i8* %26)
%28 = add nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = mul i64 %29, 1
%31 = trunc i64 %30 to i32
%32 = call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to i8*
store i8* %33, i8** %7
%34 = load i8*, i8** %7
%35 = load i8**, i8*** %4
%36 = load i8*, i8** %35
%37 = call i32 @strcpy(i8* %34, i8* %36)
%38 = load i8*, i8** %7
%39 = call i32 @strlen(i8* %38)
%40 = load i8**, i8*** %6
%41 = load i8*, i8** %40
%42 = call i32 @strlen(i8* %41)
%43 = add nsw i32 %39, %42
%44 = add nsw i32 %43, 2
%45 = sext i32 %44 to i64
%46 = mul i64 %45, 1
%47 = trunc i64 %46 to i32
%48 = call i64 @malloc(i32 %47)
%49 = inttoptr i64 %48 to i8*
%50 = load i8**, i8*** %4
store i8* %49, i8** %50
%51 = load i8**, i8*** %4
%52 = load i8*, i8** %51
%53 = load i8**, i8*** %6
%54 = load i8*, i8** %53
%55 = load i8*, i8** %7
%56 = call i32 @sprintf(i8* %52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %54, i8* %55)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
define void @prepara_saida(i8** %0, i8** nocapture %1, i8** nocapture %2) {
%4 = load i8*, i8** %1
%5 = tail call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 1
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %0
%9 = load i8*, i8** %1
%10 = tail call i32 @strcpy(i8* %8, i8* %9)
%11 = tail call i32 @prepara_string(i8** %0)
%12 = load i8*, i8** %0
%13 = tail call i32 @strlen(i8* %12)
%14 = add nsw i32 %13, 1
%15 = tail call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i8*
%17 = load i8*, i8** %0
%18 = tail call i32 @strcpy(i8* %16, i8* %17)
%19 = tail call i32 @strlen(i8* %16)
%20 = load i8*, i8** %2
%21 = tail call i32 @strlen(i8* %20)
%22 = add i32 %19, 2
%23 = add i32 %22, %21
%24 = tail call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %0
%26 = load i8*, i8** %2
%27 = tail call i32 @sprintf(i8* dereferenceable(1) %25, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %26, i8* %16)
ret void
}