void copy_number(pp1, pp2, n1, n2) char **pp1, **pp2;
int n1, n2;
{
  char *p1 = *pp1;
  char *p2 = *pp2;
  int w;
  sprintf(p1, "%d", n1);
  sprintf(p2, "%d", n2);
  w = max(strlen(p1), strlen(p2));
  sprintf(p1, "%*d", w, n1);
  sprintf(p2, "%*d", w, n2);
  p1 += strlen(p1);
  p2 += strlen(p2);
  *pp1 = p1;
  *pp2 = p2;
}


x86 assembly (clang, -O0):
<copy_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %rax,%rsi
mov    $0x0,%al
call   1040 <max@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe45(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe2d(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_number>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r13d
mov    %edx,%r15d
mov    %rsi,0x10(%rsp)
mov    %rdi,0x8(%rsp)
mov    (%rdi),%rbx
mov    (%rsi),%r12
lea    0xea5(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <max@plt>
mov    %eax,%ebp
lea    0xe62(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
add    %rbx,%rbp
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %r12,%rax
mov    0x8(%rsp),%rcx
mov    %rbp,(%rcx)
mov    0x10(%rsp),%rcx
mov    %rax,(%rcx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%*d\00"
define void @copy_number(i8** %0, i8** %1, i32 %2, i32 %3) {
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
store i8** %0, i8*** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
store i8* %13, i8** %9
%14 = load i8**, i8*** %6
%15 = load i8*, i8** %14
store i8* %15, i8** %10
%16 = load i8*, i8** %9
%17 = load i32, i32* %7
%18 = call i32 (i8*, i8*, ...) @sprintf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i8*, i8** %10
%20 = load i32, i32* %8
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i8*, i8** %9
%23 = call i64 @strlen(i8* %22)
%24 = load i8*, i8** %10
%25 = call i64 @strlen(i8* %24)
%26 = call i32 (i64, i64, ...) bitcast (i32 (...)* @max to i32 (i64, i64, ...)*)(i64 %23, i64 %25)
store i32 %26, i32* %11
%27 = load i8*, i8** %9
%28 = load i32, i32* %11
%29 = load i32, i32* %7
%30 = call i32 (i8*, i8*, ...) @sprintf(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %29)
%31 = load i8*, i8** %10
%32 = load i32, i32* %11
%33 = load i32, i32* %8
%34 = call i32 (i8*, i8*, ...) @sprintf(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32, i32 %33)
%35 = load i8*, i8** %9
%36 = call i64 @strlen(i8* %35)
%37 = load i8*, i8** %9
%38 = getelementptr inbounds i8, i8* %37, i64 %36
store i8* %38, i8** %9
%39 = load i8*, i8** %10
%40 = call i64 @strlen(i8* %39)
%41 = load i8*, i8** %10
%42 = getelementptr inbounds i8, i8* %41, i64 %40
store i8* %42, i8** %10
%43 = load i8*, i8** %9
%44 = load i8**, i8*** %5
store i8* %43, i8** %44
%45 = load i8*, i8** %10
%46 = load i8**, i8*** %6
store i8* %45, i8** %46
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%*d\00"
define void @copy_number(i8** nocapture %0, i8** nocapture %1, i32 %2, i32 %3) {
%5 = load i8*, i8** %0
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%8 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%9 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%10 = tail call i64 @strlen(i8* dereferenceable(1) %6)
%11 = tail call i32 (i64, i64, ...) bitcast (i32 (...)* @max to i32 (i64, i64, ...)*)(i64 %9, i64 %10)
%12 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %2)
%13 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %3)
%14 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%15 = getelementptr inbounds i8, i8* %5, i64 %14
%16 = tail call i64 @strlen(i8* dereferenceable(1) %6)
%17 = getelementptr inbounds i8, i8* %6, i64 %16
store i8* %15, i8** %0
store i8* %17, i8** %1
ret void
}