void asn1_add_error(const unsigned char *address, int offset) {
  char buf1[DECIMAL_SIZE(address) + 1], buf2[DECIMAL_SIZE(offset) + 1];
  BIO_snprintf(buf1, sizeof buf1, "%lu", (unsigned long)address);
  BIO_snprintf(buf2, sizeof buf2, "%d", offset);
  ERR_add_error_data(4, "address=", buf1, " offset=", buf2);
}


x86 assembly (clang, -O0):
<asn1_add_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %al,-0x49(%rbp)
call   1040 <DECIMAL_SIZE@plt>
mov    %eax,%ecx
mov    -0x49(%rbp),%al
add    $0x1,%ecx
mov    %rcx,-0x48(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <DECIMAL_SIZE@plt>
mov    -0x48(%rbp),%rsi
mov    -0x38(%rbp),%rdi
add    $0x1,%eax
mov    %rax,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xe46(%rip),%rdx
mov    $0x0,%al
call   1030 <BIO_snprintf@plt>
mov    -0x40(%rbp),%rsi
mov    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%ecx
lea    0xe31(%rip),%rdx
mov    $0x0,%al
call   1030 <BIO_snprintf@plt>
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%r8
mov    $0x4,%edi
lea    0xe19(%rip),%rsi
lea    0xe1b(%rip),%rcx
mov    $0x0,%al
call   1050 <ERR_add_error_data@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_add_error>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %esi,-0x2c(%rbp)
mov    %rdi,%r15
xor    %eax,%eax
call   1040 <DECIMAL_SIZE@plt>
lea    0x1(%rax),%r12d
lea    0xf(%r12),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <DECIMAL_SIZE@plt>
lea    0x1(%rax),%r14d
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe78(%rip),%rdx
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <BIO_snprintf@plt>
lea    0xe65(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    -0x2c(%rbp),%ecx
xor    %eax,%eax
call   1030 <BIO_snprintf@plt>
lea    0xe51(%rip),%rsi
lea    0xe53(%rip),%rcx
mov    $0x4,%edi
mov    %r13,%rdx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <ERR_add_error_data@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lu\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"address=\00"
@.str.3 = [9 x i8] c" offset=\00"
define void @asn1_add_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @DECIMAL_SIZE to i32 (i8*, ...)*)(i8* %8)
%10 = add nsw i32 %9, 1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i8, i64 %11
store i64 %11, i64* %6
%14 = load i32, i32* %4
%15 = call i32 (i32, ...) bitcast (i32 (...)* @DECIMAL_SIZE to i32 (i32, ...)*)(i32 %14)
%16 = add nsw i32 %15, 1
%17 = zext i32 %16 to i64
%18 = alloca i8, i64 %17
store i64 %17, i64* %7
%19 = load i8*, i8** %3
%20 = ptrtoint i8* %19 to i64
%21 = call i32 (i8*, i64, i8*, i64, ...) bitcast (i32 (...)* @BIO_snprintf to i32 (i8*, i64, i8*, i64, ...)*)(i8* %13, i64 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %20)
%22 = load i32, i32* %4
%23 = call i32 (i8*, i64, i8*, i32, ...) bitcast (i32 (...)* @BIO_snprintf to i32 (i8*, i64, i8*, i32, ...)*)(i8* %18, i64 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 (i32, i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @ERR_add_error_data to i32 (i32, i8*, i8*, i8*, i8*, ...)*)(i32 4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %18)
%25 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"address=\00"
@.str.3 = [9 x i8] c" offset=\00"
define void @asn1_add_error(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @DECIMAL_SIZE to i32 (i8*, ...)*)(i8* %0)
%4 = add nsw i32 %3, 1
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @DECIMAL_SIZE to i32 (i32, ...)*)(i32 %1)
%8 = add nsw i32 %7, 1
%9 = zext i32 %8 to i64
%10 = alloca i8, i64 %9
%11 = ptrtoint i8* %0 to i64
%12 = call i32 (i8*, i64, i8*, i64, ...) bitcast (i32 (...)* @BIO_snprintf to i32 (i8*, i64, i8*, i64, ...)*)(i8* %6, i64 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = call i32 (i8*, i64, i8*, i32, ...) bitcast (i32 (...)* @BIO_snprintf to i32 (i8*, i64, i8*, i32, ...)*)(i8* %10, i64 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%14 = call i32 (i32, i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @ERR_add_error_data to i32 (i32, i8*, i8*, i8*, i8*, ...)*)(i32 4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %10)
ret void
}