void copyStr2(char **pa, char **pb) {
  printf("%-12s = %8d\n", "pa", pa);
  printf("%-12s = %8d\n", "*pa", *pa);
  printf("%-12s = %8d\n", "**pa", **pa);
  while (**pa != '\0') {
    printf("%c", **pa);
    *(*pb)++ = *(*pa)++;
  }
  puts("\n");
  **pb = '\0';
}


x86 assembly (clang, -O0):
<copyStr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xec5(%rip),%rdi
lea    0xecd(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xea9(%rip),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edx
lea    0xe8a(%rip),%rdi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11da <copyStr2+0xba>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
mov    (%rax),%cl
mov    -0x10(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
jmp    1184 <copyStr2+0x64>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyStr2>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebe(%rip),%r15
lea    0xec6(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%rdx
lea    0xeae(%rip),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%rax
movsbl (%rax),%edx
lea    0xe96(%rip),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%rax
movzbl (%rax),%eax
test   %al,%al
je     11bd <copyStr2+0x8d>
movsbl %al,%edi
call   1030 <putchar@plt>
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movzbl (%rax),%eax
mov    (%r14),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%r14)
mov    %al,(%rcx)
jmp    1190 <copyStr2+0x60>
lea    0xe47(%rip),%rdi
xor    %eax,%eax
call   1040 <puts@plt>
mov    (%r14),%rax
movb   $0x0,(%rax)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%-12s = %8d\0A\00"
@.str.1 = [3 x i8] c"pa\00"
@.str.2 = [4 x i8] c"*pa\00"
@.str.3 = [5 x i8] c"**pa\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @copyStr2(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %5)
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %21, %2
%16 = load i8**, i8*** %3
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %34
21: ; preds = %15
%22 = load i8**, i8*** %3
%23 = load i8*, i8** %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = load i8**, i8*** %3
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %27
%30 = load i8, i8* %28
%31 = load i8**, i8*** %4
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %31
store i8 %30, i8* %32
br label %15
34: ; preds = %15
%35 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%36 = load i8**, i8*** %4
%37 = load i8*, i8** %36
store i8 0, i8* %37
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%-12s = %8d\0A\00"
@.str.1 = [3 x i8] c"pa\00"
@.str.2 = [4 x i8] c"*pa\00"
@.str.3 = [5 x i8] c"**pa\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @copyStr2(i8** %0, i8** nocapture %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %0)
%4 = load i8*, i8** %0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %0
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %2, %13
%14 = phi i8 [ %23, %13 ], [ %11, %2 ]
%15 = sext i8 %14 to i32
%16 = tail call i32 @putchar(i32 %15)
%17 = load i8*, i8** %0
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8* %18, i8** %0
%19 = load i8, i8* %17
%20 = load i8*, i8** %1
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8* %21, i8** %1
store i8 %19, i8* %20
%22 = load i8*, i8** %0
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %13
25: ; preds = %13, %2
%26 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%27 = load i8*, i8** %1
store i8 0, i8* %27
ret void
}