#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 */
typedef int /*<<< orphan*/ SXNET;
typedef int /*<<< orphan*/ ASN1_OCTET_STRING;
typedef int /*<<< orphan*/ ASN1_INTEGER;

/* Variables and functions */
int /*<<< orphan*/ ASN1_INTEGER_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *SXNET_get_id_INTEGER(int /*<<< orphan*/ *,
                                         int /*<<< orphan*/ *);
int /*<<< orphan*/ X509V3_R_ERROR_CONVERTING_ZONE;
int /*<<< orphan*/ X509V3error(int /*<<< orphan*/);
int /*<<< orphan*/ *s2i_ASN1_INTEGER(int /*<<< orphan*/ *, char const *);
ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone) {
  ASN1_INTEGER *izone = NULL;
  ASN1_OCTET_STRING *oct;
  if (!(izone = s2i_ASN1_INTEGER(NULL, zone))) {
    X509V3error(X509V3_R_ERROR_CONVERTING_ZONE);
    return NULL;
  }
  oct = SXNET_get_id_INTEGER(sx, izone);
  ASN1_INTEGER_free(izone);
  return oct;
}


x86 assembly (clang, -O0):
<SXNET_get_id_asc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <s2i_ASN1_INTEGER@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    118e <SXNET_get_id_asc+0x4e>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1040 <X509V3error@plt>
movq   $0x0,-0x8(%rbp)
jmp    11b0 <SXNET_get_id_asc+0x70>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <SXNET_get_id_INTEGER@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <ASN1_INTEGER_free@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SXNET_get_id_asc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
call   1030 <s2i_ASN1_INTEGER@plt>
test   %rax,%rax
je     1171 <SXNET_get_id_asc+0x31>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <SXNET_get_id_INTEGER@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1060 <ASN1_INTEGER_free@plt>
mov    %r14,%rax
jmp    1181 <SXNET_get_id_asc+0x41>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1040 <X509V3error@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@X509V3_R_ERROR_CONVERTING_ZONE = global i32 0
define i32* @SXNET_get_id_asc(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32* null, i32** %6
%8 = load i8*, i8** %5
%9 = call i32* @s2i_ASN1_INTEGER(i32* null, i8* %8)
store i32* %9, i32** %6
%10 = icmp ne i32* %9, null
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i32, i32* @X509V3_R_ERROR_CONVERTING_ZONE
%13 = call i32 @X509V3error(i32 %12)
store i32* null, i32** %3
br label %21
14: ; preds = %2
%15 = load i32*, i32** %4
%16 = load i32*, i32** %6
%17 = call i32* @SXNET_get_id_INTEGER(i32* %15, i32* %16)
store i32* %17, i32** %7
%18 = load i32*, i32** %6
%19 = call i32 @ASN1_INTEGER_free(i32* %18)
%20 = load i32*, i32** %7
store i32* %20, i32** %3
br label %21
21: ; preds = %14, %11
%22 = load i32*, i32** %3
ret i32* %22
}

LLVM IR (-O2):
@X509V3_R_ERROR_CONVERTING_ZONE = global i32 0
define i32* @SXNET_get_id_asc(i32* %0, i8* %1) {
%3 = tail call i32* @s2i_ASN1_INTEGER(i32* null, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @X509V3_R_ERROR_CONVERTING_ZONE
%7 = tail call i32 @X509V3error(i32 %6)
br label %11
8: ; preds = %2
%9 = tail call i32* @SXNET_get_id_INTEGER(i32* %0, i32* %3)
%10 = tail call i32 @ASN1_INTEGER_free(i32* %3)
br label %11
11: ; preds = %8, %5
%12 = phi i32* [ %9, %8 ], [ null, %5 ]
ret i32* %12
}