#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 */
struct TYPE_5__ {
  TYPE_2__ *usr_data;
};
typedef TYPE_1__ X509V3_EXT_METHOD;
struct TYPE_6__ {
  long bitnum;
  scalar_t__ lname;
};
typedef TYPE_2__ ENUMERATED_NAMES;
typedef int /*<<< orphan*/ ASN1_ENUMERATED;

/* Variables and functions */
long ASN1_ENUMERATED_get(int /*<<< orphan*/ const *);
char *i2s_ASN1_ENUMERATED(TYPE_1__ *, int /*<<< orphan*/ const *);
char *strdup(scalar_t__);
char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method,
                                const ASN1_ENUMERATED *e) {
  ENUMERATED_NAMES *enam;
  long strval;
  strval = ASN1_ENUMERATED_get(e);
  for (enam = method->usr_data; enam->lname; enam++) {
    if (strval == enam->bitnum)
      return strdup(enam->lname);
  }
  return i2s_ASN1_ENUMERATED(method, e);
}


x86 assembly (clang, -O0):
<i2s_ASN1_ENUMERATED_TABLE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ASN1_ENUMERATED_get@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11a4 <i2s_ASN1_ENUMERATED_TABLE+0x74>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%rax
jne    118e <i2s_ASN1_ENUMERATED_TABLE+0x5e>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11b5 <i2s_ASN1_ENUMERATED_TABLE+0x85>
jmp    1193 <i2s_ASN1_ENUMERATED_TABLE+0x63>
mov    -0x20(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x20(%rbp)
jmp    1158 <i2s_ASN1_ENUMERATED_TABLE+0x28>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <i2s_ASN1_ENUMERATED@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2s_ASN1_ENUMERATED_TABLE>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <ASN1_ENUMERATED_get@plt>
mov    (%rbx),%rcx
mov    0x8(%rcx),%rdi
test   %rdi,%rdi
je     1181 <i2s_ASN1_ENUMERATED_TABLE+0x51>
cmp    (%rcx),%rax
je     1175 <i2s_ASN1_ENUMERATED_TABLE+0x45>
add    $0x18,%rcx
nopw   0x0(%rax,%rax,1)
mov    (%rcx),%rdi
test   %rdi,%rdi
je     1181 <i2s_ASN1_ENUMERATED_TABLE+0x51>
lea    0x10(%rcx),%rdx
cmp    -0x8(%rcx),%rax
mov    %rdx,%rcx
jne    1160 <i2s_ASN1_ENUMERATED_TABLE+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <strdup@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <i2s_ASN1_ENUMERATED@plt>

LLVM IR (-O0):
%struct.TYPE_5__ = type { %struct.TYPE_6__* }
%struct.TYPE_6__ = type { i64, i64 }
define i8* @i2s_ASN1_ENUMERATED_TABLE(%struct.TYPE_5__* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32*
%6 = alloca %struct.TYPE_6__*
%7 = alloca i64
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %4
store i32* %1, i32** %5
%8 = load i32*, i32** %5
%9 = call i64 @ASN1_ENUMERATED_get(i32* %8)
store i64 %9, i64* %7
%10 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%11 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %10, i32 0, i32 0
%12 = load %struct.TYPE_6__*, %struct.TYPE_6__** %11
store %struct.TYPE_6__* %12, %struct.TYPE_6__** %6
br label %13
13: ; preds = %30, %2
%14 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%15 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %14, i32 0, i32 1
%16 = load i64, i64* %15
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %33
18: ; preds = %13
%19 = load i64, i64* %7
%20 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%21 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %20, i32 0, i32 0
%22 = load i64, i64* %21
%23 = icmp eq i64 %19, %22
br i1 %23, label %24, label %29
24: ; preds = %18
%25 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%26 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %25, i32 0, i32 1
%27 = load i64, i64* %26
%28 = call i8* @strdup(i64 %27)
store i8* %28, i8** %3
br label %37
29: ; preds = %18
br label %30
30: ; preds = %29
%31 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%32 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %31, i32 1
store %struct.TYPE_6__* %32, %struct.TYPE_6__** %6
br label %13
33: ; preds = %13
%34 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%35 = load i32*, i32** %5
%36 = call i8* @i2s_ASN1_ENUMERATED(%struct.TYPE_5__* %34, i32* %35)
store i8* %36, i8** %3
br label %37
37: ; preds = %33, %24
%38 = load i8*, i8** %3
ret i8* %38
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { %struct.TYPE_6__* }
%struct.TYPE_6__ = type { i64, i64 }
define i8* @i2s_ASN1_ENUMERATED_TABLE(%struct.TYPE_5__* %0, i32* %1) {
%3 = tail call i64 @ASN1_ENUMERATED_get(i32* %1)
%4 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0
%5 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%6 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 1
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 0
br i1 %8, label %26, label %9
9: ; preds = %2
%10 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 0
%11 = load i64, i64* %10
%12 = icmp eq i64 %3, %11
br i1 %12, label %23, label %13
13: ; preds = %9, %19
%14 = phi %struct.TYPE_6__* [ %15, %19 ], [ %5, %9 ]
%15 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %14, i64 1
%16 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %14, i64 1, i32 1
%17 = load i64, i64* %16
%18 = icmp eq i64 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %13
%20 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %15, i64 0, i32 0
%21 = load i64, i64* %20
%22 = icmp eq i64 %3, %21
br i1 %22, label %23, label %13
23: ; preds = %19, %9
%24 = phi i64 [ %7, %9 ], [ %17, %19 ]
%25 = tail call i8* @strdup(i64 %24)
br label %28
26: ; preds = %13, %2
%27 = tail call i8* @i2s_ASN1_ENUMERATED(%struct.TYPE_5__* %0, i32* %1)
br label %28
28: ; preds = %26, %23
%29 = phi i8* [ %25, %23 ], [ %27, %26 ]
ret i8* %29
}