#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 *basename(char *);
char *dirname(char *);
int /*<<< orphan*/ free(char *);
char *fullpath(char *, char *);
char *my_strdup(char *);
void canonized_fn(char *des[3], char *arg) {
  char *tmpmask;
  tmpmask = my_strdup(arg);
  des[0] = my_strdup(dirname(tmpmask));
  free(tmpmask);
  tmpmask = my_strdup(arg);
  des[1] = my_strdup(basename(tmpmask));
  free(tmpmask);
  des[2] = fullpath(des[0], des[1]);
}


x86 assembly (clang, -O0):
<canonized_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <my_strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <dirname@plt>
mov    %rax,%rdi
call   1060 <my_strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1060 <my_strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <basename@plt>
mov    %rax,%rdi
call   1060 <my_strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rsi
call   1070 <fullpath@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<canonized_fn>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1060 <my_strdup@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1040 <dirname@plt>
mov    %rax,%rdi
call   1060 <my_strdup@plt>
mov    %rax,(%rbx)
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1060 <my_strdup@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <basename@plt>
mov    %rax,%rdi
call   1060 <my_strdup@plt>
mov    %rax,0x8(%rbx)
mov    %r14,%rdi
call   1030 <free@plt>
mov    (%rbx),%rdi
mov    0x8(%rbx),%rsi
call   1070 <fullpath@plt>
mov    %rax,0x10(%rbx)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @canonized_fn(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 i8* @my_strdup(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = call i8* @dirname(i8* %8)
%10 = call i8* @my_strdup(i8* %9)
%11 = load i8**, i8*** %3
%12 = getelementptr inbounds i8*, i8** %11, i64 0
store i8* %10, i8** %12
%13 = load i8*, i8** %5
%14 = call i32 @free(i8* %13)
%15 = load i8*, i8** %4
%16 = call i8* @my_strdup(i8* %15)
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = call i8* @basename(i8* %17)
%19 = call i8* @my_strdup(i8* %18)
%20 = load i8**, i8*** %3
%21 = getelementptr inbounds i8*, i8** %20, i64 1
store i8* %19, i8** %21
%22 = load i8*, i8** %5
%23 = call i32 @free(i8* %22)
%24 = load i8**, i8*** %3
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %3
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i8* @fullpath(i8* %26, i8* %29)
%31 = load i8**, i8*** %3
%32 = getelementptr inbounds i8*, i8** %31, i64 2
store i8* %30, i8** %32
ret void
}

LLVM IR (-O2):
define void @canonized_fn(i8** nocapture %0, i8* %1) {
%3 = tail call i8* @my_strdup(i8* %1)
%4 = tail call i8* @dirname(i8* %3)
%5 = tail call i8* @my_strdup(i8* %4)
store i8* %5, i8** %0
%6 = tail call i32 @free(i8* %3)
%7 = tail call i8* @my_strdup(i8* %1)
%8 = tail call i8* @basename(i8* %7)
%9 = tail call i8* @my_strdup(i8* %8)
%10 = getelementptr inbounds i8*, i8** %0, i64 1
store i8* %9, i8** %10
%11 = tail call i32 @free(i8* %7)
%12 = load i8*, i8** %0
%13 = load i8*, i8** %10
%14 = tail call i8* @fullpath(i8* %12, i8* %13)
%15 = getelementptr inbounds i8*, i8** %0, i64 2
store i8* %14, i8** %15
ret void
}