#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*/ ft_memdel(void **);
char *ft_strdup(char *);
char *ft_strjoin_free(char *, int /*<<< orphan*/, char *, int);
void transfer_minus(char **ppad, void **addr) {
  char *swap;
  if (ppad && addr) {
    swap = ft_strdup((char *)(*addr + 1));
    ft_memdel(addr);
    *addr = swap;
    *ppad = ft_strjoin_free("-", 0, *ppad, 1);
  }
}


x86 assembly (clang, -O0):
<transfer_minus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11a2 <transfer_minus+0x72>
cmpq   $0x0,-0x10(%rbp)
je     11a2 <transfer_minus+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
add    $0x1,%rdi
call   1050 <ft_strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ft_memdel@plt>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xe74(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%ecx
call   1040 <ft_strjoin_free@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer_minus>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1178 <transfer_minus+0x48>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1178 <transfer_minus+0x48>
mov    %rdi,%r14
mov    (%rbx),%rdi
add    $0x1,%rdi
call   1050 <ft_strdup@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <ft_memdel@plt>
mov    %r15,(%rbx)
mov    (%r14),%rdx
lea    0xe97(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%ecx
call   1040 <ft_strjoin_free@plt>
mov    %rax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
define void @transfer_minus(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*** %3
%7 = icmp ne i8** %6, null
br i1 %7, label %8, label %24
8: ; preds = %2
%9 = load i8**, i8*** %4
%10 = icmp ne i8** %9, null
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load i8**, i8*** %4
%13 = load i8*, i8** %12
%14 = getelementptr i8, i8* %13, i64 1
%15 = call i8* @ft_strdup(i8* %14)
store i8* %15, i8** %5
%16 = load i8**, i8*** %4
%17 = call i32 @ft_memdel(i8** %16)
%18 = load i8*, i8** %5
%19 = load i8**, i8*** %4
store i8* %18, i8** %19
%20 = load i8**, i8*** %3
%21 = load i8*, i8** %20
%22 = call i8* @ft_strjoin_free(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0, i8* %21, i32 1)
%23 = load i8**, i8*** %3
store i8* %22, i8** %23
br label %24
24: ; preds = %11, %8, %2
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
define void @transfer_minus(i8** %0, i8** %1) {
%3 = icmp ne i8** %0, null
%4 = icmp ne i8** %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = getelementptr i8, i8* %7, i64 1
%9 = tail call i8* @ft_strdup(i8* %8)
%10 = tail call i32 @ft_memdel(i8** %1)
store i8* %9, i8** %1
%11 = load i8*, i8** %0
%12 = tail call i8* @ft_strjoin_free(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0, i8* %11, i32 1)
store i8* %12, i8** %0
br label %13
13: ; preds = %6, %2
ret void
}