#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int length;
  int /*<<< orphan*/ data;
};
typedef TYPE_1__ ASN1_OCTET_STRING;

/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, int /*<<< orphan*/, int);
int i2d_ocsp_nonce(void *a, unsigned char **pp) {
  ASN1_OCTET_STRING *os = a;
  if (pp) {
    memcpy(*pp, os->data, os->length);
    *pp += os->length;
  }
  return os->length;
}


x86 assembly (clang, -O0):
<i2d_ocsp_nonce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1162 <i2d_ocsp_nonce+0x52>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2d_ocsp_nonce>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %rsi,%rsi
je     1134 <i2d_ocsp_nonce+0x24>
mov    %rsi,%r14
mov    (%rsi),%rdi
mov    (%rbx),%edx
mov    0x4(%rbx),%esi
call   1030 <memcpy@plt>
movslq (%rbx),%rax
add    %rax,(%r14)
jmp    1136 <i2d_ocsp_nonce+0x26>
mov    (%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32, i32 }
define i32 @i2d_ocsp_nonce(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca %struct.TYPE_2__*
store i8* %0, i8** %3
store i8** %1, i8*** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
store %struct.TYPE_2__* %7, %struct.TYPE_2__** %5
%8 = load i8**, i8*** %4
%9 = icmp ne i8** %8, null
br i1 %9, label %10, label %27
10: ; preds = %2
%11 = load i8**, i8*** %4
%12 = load i8*, i8** %11
%13 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%14 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%17 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 @memcpy(i8* %12, i32 %15, i32 %18)
%20 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%21 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %20, i32 0, i32 0
%22 = load i32, i32* %21
%23 = load i8**, i8*** %4
%24 = load i8*, i8** %23
%25 = sext i32 %22 to i64
%26 = getelementptr inbounds i8, i8* %24, i64 %25
store i8* %26, i8** %23
br label %27
27: ; preds = %10, %2
%28 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%29 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %28, i32 0, i32 0
%30 = load i32, i32* %29
ret i32 %30
}

LLVM IR (-O2):
define i32 @i2d_ocsp_nonce(i8* nocapture %0, i8** %1) {
%3 = icmp eq i8** %1, null
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
br label %19
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = bitcast i8* %0 to i32*
%13 = load i32, i32* %12
%14 = tail call i32 @memcpy(i8* %8, i32 %11, i32 %13)
%15 = load i32, i32* %12
%16 = load i8*, i8** %1
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8* %18, i8** %1
br label %19
19: ; preds = %4, %7
%20 = phi i32 [ %6, %4 ], [ %15, %7 ]
ret i32 %20
}