#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*/ sprintf(char *, char *, int, ...);
int strlen(char *);
void copy_number(char **pp1, char **pp2, int n1, int n2) {
  char *p1 = *pp1;
  char *p2 = *pp2;
  int w;
  sprintf(p1, "%d", n1);
  sprintf(p2, "%d", n2);
  w = (((strlen(p1)) > (strlen(p2))) ? (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    0xea6(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cmp    %ecx,%eax
jle    11a9 <copy_number+0x89>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x34(%rbp)
jmp    11b5 <copy_number+0x95>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe37(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%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    0xeb5(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
mov    %r12,%rdi
cmovg  %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xe72(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movslq %eax,%rbp
add    %rbx,%rbp
mov    %r12,%rdi
call   1030 <strlen@plt>
cltq
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*, i32, ...) @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*, i32, ...) @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 i32 @strlen(i8* %22)
%24 = load i8*, i8** %10
%25 = call i32 @strlen(i8* %24)
%26 = icmp sgt i32 %23, %25
br i1 %26, label %27, label %30
27: ; preds = %4
%28 = load i8*, i8** %9
%29 = call i32 @strlen(i8* %28)
br label %33
30: ; preds = %4
%31 = load i8*, i8** %10
%32 = call i32 @strlen(i8* %31)
br label %33
33: ; preds = %30, %27
%34 = phi i32 [ %29, %27 ], [ %32, %30 ]
store i32 %34, i32* %11
%35 = load i8*, i8** %9
%36 = load i32, i32* %11
%37 = load i32, i32* %7
%38 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36, i32 %37)
%39 = load i8*, i8** %10
%40 = load i32, i32* %11
%41 = load i32, i32* %8
%42 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %40, i32 %41)
%43 = load i8*, i8** %9
%44 = call i32 @strlen(i8* %43)
%45 = load i8*, i8** %9
%46 = sext i32 %44 to i64
%47 = getelementptr inbounds i8, i8* %45, i64 %46
store i8* %47, i8** %9
%48 = load i8*, i8** %10
%49 = call i32 @strlen(i8* %48)
%50 = load i8*, i8** %10
%51 = sext i32 %49 to i64
%52 = getelementptr inbounds i8, i8* %50, i64 %51
store i8* %52, i8** %10
%53 = load i8*, i8** %9
%54 = load i8**, i8*** %5
store i8* %53, i8** %54
%55 = load i8*, i8** %10
%56 = load i8**, i8*** %6
store i8* %55, i8** %56
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*, i32, ...) @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*, i32, ...) @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 i32 @strlen(i8* %5)
%10 = tail call i32 @strlen(i8* %6)
%11 = icmp sgt i32 %9, %10
%12 = select i1 %11, i8* %5, i8* %6
%13 = tail call i32 @strlen(i8* %12)
%14 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %2)
%15 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %3)
%16 = tail call i32 @strlen(i8* %5)
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %5, i64 %17
%19 = tail call i32 @strlen(i8* %6)
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %6, i64 %20
store i8* %18, i8** %0
store i8* %21, i8** %1
ret void
}