#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_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ X509V3_EXT_METHOD;
struct TYPE_6__ {
  int /*<<< orphan*/ ids;
  int /*<<< orphan*/ version;
};
struct TYPE_5__ {
  int /*<<< orphan*/ user;
  int /*<<< orphan*/ zone;
};
typedef TYPE_1__ SXNETID;
typedef TYPE_2__ SXNET;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
long ASN1_INTEGER_get(int /*<<< orphan*/);
int /*<<< orphan*/ ASN1_STRING_print(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ BIO_printf(int /*<<< orphan*/ *, char *, int, char *, ...);
int /*<<< orphan*/ free(char *);
char *i2s_ASN1_INTEGER(int /*<<< orphan*/ *, int /*<<< orphan*/);
int sk_SXNETID_num(int /*<<< orphan*/);
TYPE_1__ *sk_SXNETID_value(int /*<<< orphan*/, int);
int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out, int indent) {
  long v;
  char *tmp;
  SXNETID *id;
  int i;
  v = ASN1_INTEGER_get(sx->version);
  BIO_printf(out, "%*sVersion: %ld (0x%lX)", indent, "", v + 1, v);
  for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
    id = sk_SXNETID_value(sx->ids, i);
    tmp = i2s_ASN1_INTEGER(NULL, id->zone);
    BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp);
    free(tmp);
    ASN1_STRING_print(out, id->user);
  }
  return 1;
}


x86 assembly (clang, -O0):
<sxnet_i2r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
call   1080 <ASN1_INTEGER_get@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%r8
add    $0x1,%r8
mov    -0x28(%rbp),%r9
lea    0xe4f(%rip),%rsi
lea    0xe74(%rip),%rcx
mov    $0x0,%al
call   1040 <BIO_printf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1060 <sk_SXNETID_num@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
cmp    %ecx,%eax
jge    1250 <sxnet_i2r+0xe0>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x3c(%rbp),%esi
call   1090 <sk_SXNETID_value@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%esi
xor    %eax,%eax
mov    %eax,%edi
call   1050 <i2s_ASN1_INTEGER@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x30(%rbp),%r8
lea    0xdfc(%rip),%rsi
lea    0xe09(%rip),%rcx
mov    $0x0,%al
call   1040 <BIO_printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
call   1070 <ASN1_STRING_print@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11c6 <sxnet_i2r+0x56>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sxnet_i2r>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r13
mov    %rsi,%rbp
mov    0x4(%rsi),%edi
call   1080 <ASN1_INTEGER_get@plt>
lea    0x1(%rax),%r8
lea    0xe69(%rip),%rsi
lea    0xe8e(%rip),%rcx
mov    %r13,%rdi
mov    %r14d,%edx
mov    %rax,%r9
xor    %eax,%eax
call   1040 <BIO_printf@plt>
mov    0x0(%rbp),%edi
call   1060 <sk_SXNETID_num@plt>
test   %eax,%eax
jle    121a <sxnet_i2r+0xaa>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x0(%rbp),%edi
mov    %ebx,%esi
call   1090 <sk_SXNETID_value@plt>
mov    %rax,%r15
mov    0x4(%rax),%esi
xor    %edi,%edi
call   1050 <i2s_ASN1_INTEGER@plt>
mov    %rax,%r12
mov    %r13,%rdi
lea    0xe34(%rip),%rsi
mov    %r14d,%edx
lea    0xe3e(%rip),%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1040 <BIO_printf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    (%r15),%esi
mov    %r13,%rdi
call   1070 <ASN1_STRING_print@plt>
add    $0x1,%ebx
mov    0x0(%rbp),%edi
call   1060 <sk_SXNETID_num@plt>
cmp    %eax,%ebx
jl     11c0 <sxnet_i2r+0x50>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, i32 }
%struct.TYPE_5__ = type { i32, i32 }
@.str = [24 x i8] c"%*sVersion: %ld (0x%lX)\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [21 x i8] c"\0A%*sZone: %s, User: \00"
define i32 @sxnet_i2r(i32* %0, %struct.TYPE_6__* %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca %struct.TYPE_6__*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i64
%10 = alloca i8*
%11 = alloca %struct.TYPE_5__*
%12 = alloca i32
store i32* %0, i32** %5
store %struct.TYPE_6__* %1, %struct.TYPE_6__** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%13 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%14 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = call i64 @ASN1_INTEGER_get(i32 %15)
store i64 %16, i64* %9
%17 = load i32*, i32** %7
%18 = load i32, i32* %8
%19 = load i64, i64* %9
%20 = add nsw i64 %19, 1
%21 = load i64, i64* %9
%22 = call i32 (i32*, i8*, i32, i8*, ...) @BIO_printf(i32* %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %18, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i64 %20, i64 %21)
store i32 0, i32* %12
br label %23
23: ; preds = %51, %4
%24 = load i32, i32* %12
%25 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%26 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %25, i32 0, i32 0
%27 = load i32, i32* %26
%28 = call i32 @sk_SXNETID_num(i32 %27)
%29 = icmp slt i32 %24, %28
br i1 %29, label %30, label %54
30: ; preds = %23
%31 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%32 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %31, i32 0, i32 0
%33 = load i32, i32* %32
%34 = load i32, i32* %12
%35 = call %struct.TYPE_5__* @sk_SXNETID_value(i32 %33, i32 %34)
store %struct.TYPE_5__* %35, %struct.TYPE_5__** %11
%36 = load %struct.TYPE_5__*, %struct.TYPE_5__** %11
%37 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %36, i32 0, i32 1
%38 = load i32, i32* %37
%39 = call i8* @i2s_ASN1_INTEGER(i32* null, i32 %38)
store i8* %39, i8** %10
%40 = load i32*, i32** %7
%41 = load i32, i32* %8
%42 = load i8*, i8** %10
%43 = call i32 (i32*, i8*, i32, i8*, ...) @BIO_printf(i32* %40, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %41, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %42)
%44 = load i8*, i8** %10
%45 = call i32 @free(i8* %44)
%46 = load i32*, i32** %7
%47 = load %struct.TYPE_5__*, %struct.TYPE_5__** %11
%48 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %47, i32 0, i32 0
%49 = load i32, i32* %48
%50 = call i32 @ASN1_STRING_print(i32* %46, i32 %49)
br label %51
51: ; preds = %30
%52 = load i32, i32* %12
%53 = add nsw i32 %52, 1
store i32 %53, i32* %12
br label %23
54: ; preds = %23
ret i32 1
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32, i32 }
%struct.TYPE_5__ = type { i32, i32 }
@.str = [24 x i8] c"%*sVersion: %ld (0x%lX)\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [21 x i8] c"\0A%*sZone: %s, User: \00"
define i32 @sxnet_i2r(i32* nocapture readnone %0, %struct.TYPE_6__* nocapture %1, i32* %2, i32 %3) {
%5 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 1
%6 = load i32, i32* %5
%7 = tail call i64 @ASN1_INTEGER_get(i32 %6)
%8 = add nsw i64 %7, 1
%9 = tail call i32 (i32*, i8*, i32, i8*, ...) @BIO_printf(i32* %2, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i64 %8, i64 %7)
%10 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 0
%11 = load i32, i32* %10
%12 = tail call i32 @sk_SXNETID_num(i32 %11)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %30
14: ; preds = %4, %14
%15 = phi i32 [ %26, %14 ], [ 0, %4 ]
%16 = load i32, i32* %10
%17 = tail call %struct.TYPE_5__* @sk_SXNETID_value(i32 %16, i32 %15)
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %17, i64 0, i32 1
%19 = load i32, i32* %18
%20 = tail call i8* @i2s_ASN1_INTEGER(i32* null, i32 %19)
%21 = tail call i32 (i32*, i8*, i32, i8*, ...) @BIO_printf(i32* %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = tail call i32 @free(i8* %20)
%23 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %17, i64 0, i32 0
%24 = load i32, i32* %23
%25 = tail call i32 @ASN1_STRING_print(i32* %2, i32 %24)
%26 = add nuw nsw i32 %15, 1
%27 = load i32, i32* %10
%28 = tail call i32 @sk_SXNETID_num(i32 %27)
%29 = icmp slt i32 %26, %28
br i1 %29, label %14, label %30
30: ; preds = %14, %4
ret i32 1
}