#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__ {
  int /*<<< orphan*/ uniformResourceIdentifier;
  int /*<<< orphan*/ rfc822Name;
  int /*<<< orphan*/ dNSName;
  int /*<<< orphan*/ directoryName;
};
struct TYPE_6__ {
  int type;
  TYPE_1__ d;
};
typedef TYPE_2__ GENERAL_NAME;

/* Variables and functions */
#define GEN_DIRNAME 131
#define GEN_DNS 130
#define GEN_EMAIL 129
#define GEN_URI 128
int X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE;
int nc_dn(int /*<<< orphan*/, int /*<<< orphan*/);
int nc_dns(int /*<<< orphan*/, int /*<<< orphan*/);
int nc_email(int /*<<< orphan*/, int /*<<< orphan*/);
int nc_uri(int /*<<< orphan*/, int /*<<< orphan*/);
int nc_match_single(GENERAL_NAME *gen, GENERAL_NAME *base) {
  switch (base->type) {
  case GEN_DIRNAME:
    return nc_dn(gen->d.directoryName, base->d.directoryName);
  case GEN_DNS:
    return nc_dns(gen->d.dNSName, base->d.dNSName);
  case GEN_EMAIL:
    return nc_email(gen->d.rfc822Name, base->d.rfc822Name);
  case GEN_URI:
    return nc_uri(gen->d.uniformResourceIdentifier,
                  base->d.uniformResourceIdentifier);
  default:
    return X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE;
  }
}


x86 assembly (clang, -O0):
<nc_match_single>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     11e8 <nc_match_single+0xa8>
mov    -0x20(%rbp),%rax
lea    0xe8d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%esi
call   1050 <nc_dn@plt>
mov    %eax,-0x4(%rbp)
jmp    11f4 <nc_match_single+0xb4>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%esi
call   1030 <nc_dns@plt>
mov    %eax,-0x4(%rbp)
jmp    11f4 <nc_match_single+0xb4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%esi
call   1040 <nc_email@plt>
mov    %eax,-0x4(%rbp)
jmp    11f4 <nc_match_single+0xb4>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%esi
call   1060 <nc_uri@plt>
mov    %eax,-0x4(%rbp)
jmp    11f4 <nc_match_single+0xb4>
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nc_match_single>:
mov    (%rsi),%eax
add    $0xffffff80,%eax
cmp    $0x3,%eax
ja     1165 <nc_match_single+0x25>
lea    0xeaf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x4(%rdi),%edi
mov    0x4(%rsi),%esi
jmp    1060 <nc_uri@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%eax
ret
mov    0x8(%rdi),%edi
mov    0x8(%rsi),%esi
jmp    1040 <nc_email@plt>
mov    0xc(%rdi),%edi
mov    0xc(%rsi),%esi
jmp    1030 <nc_dns@plt>
mov    0x10(%rdi),%edi
mov    0x10(%rsi),%esi
jmp    1050 <nc_dn@plt>

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, %struct.TYPE_5__ }
%struct.TYPE_5__ = type { i32, i32, i32, i32 }
@X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE = global i32 0
define i32 @nc_match_single(%struct.TYPE_6__* %0, %struct.TYPE_6__* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_6__*
%5 = alloca %struct.TYPE_6__*
store %struct.TYPE_6__* %0, %struct.TYPE_6__** %4
store %struct.TYPE_6__* %1, %struct.TYPE_6__** %5
%6 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%7 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %6, i32 0, i32 0
%8 = load i32, i32* %7
switch i32 %8, label %49 [
i32 131, label %9
i32 130, label %19
i32 129, label %29
i32 128, label %39
]
9: ; preds = %2
%10 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%11 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %10, i32 0, i32 1
%12 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %11, i32 0, i32 3
%13 = load i32, i32* %12
%14 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%15 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %14, i32 0, i32 1
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 3
%17 = load i32, i32* %16
%18 = call i32 @nc_dn(i32 %13, i32 %17)
store i32 %18, i32* %3
br label %51
19: ; preds = %2
%20 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%21 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %20, i32 0, i32 1
%22 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %21, i32 0, i32 2
%23 = load i32, i32* %22
%24 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%25 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %24, i32 0, i32 1
%26 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %25, i32 0, i32 2
%27 = load i32, i32* %26
%28 = call i32 @nc_dns(i32 %23, i32 %27)
store i32 %28, i32* %3
br label %51
29: ; preds = %2
%30 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%31 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %30, i32 0, i32 1
%32 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %31, i32 0, i32 1
%33 = load i32, i32* %32
%34 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%35 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %34, i32 0, i32 1
%36 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %35, i32 0, i32 1
%37 = load i32, i32* %36
%38 = call i32 @nc_email(i32 %33, i32 %37)
store i32 %38, i32* %3
br label %51
39: ; preds = %2
%40 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%41 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %40, i32 0, i32 1
%42 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %41, i32 0, i32 0
%43 = load i32, i32* %42
%44 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%45 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %44, i32 0, i32 1
%46 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %45, i32 0, i32 0
%47 = load i32, i32* %46
%48 = call i32 @nc_uri(i32 %43, i32 %47)
store i32 %48, i32* %3
br label %51
49: ; preds = %2
%50 = load i32, i32* @X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE
store i32 %50, i32* %3
br label %51
51: ; preds = %49, %39, %29, %19, %9
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32, %struct.TYPE_5__ }
%struct.TYPE_5__ = type { i32, i32, i32, i32 }
@X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE = global i32 0
define i32 @nc_match_single(%struct.TYPE_6__* nocapture %0, %struct.TYPE_6__* nocapture %1) {
%3 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 0
%4 = load i32, i32* %3
switch i32 %4, label %29 [
i32 131, label %5
i32 130, label %11
i32 129, label %17
i32 128, label %23
]
5: ; preds = %2
%6 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 1, i32 3
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 1, i32 3
%9 = load i32, i32* %8
%10 = tail call i32 @nc_dn(i32 %7, i32 %9)
br label %31
11: ; preds = %2
%12 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 1, i32 2
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 1, i32 2
%15 = load i32, i32* %14
%16 = tail call i32 @nc_dns(i32 %13, i32 %15)
br label %31
17: ; preds = %2
%18 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 1, i32 1
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 1, i32 1
%21 = load i32, i32* %20
%22 = tail call i32 @nc_email(i32 %19, i32 %21)
br label %31
23: ; preds = %2
%24 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 1, i32 0
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 1, i32 0
%27 = load i32, i32* %26
%28 = tail call i32 @nc_uri(i32 %25, i32 %27)
br label %31
29: ; preds = %2
%30 = load i32, i32* @X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE
br label %31
31: ; preds = %29, %23, %17, %11, %5
%32 = phi i32 [ %30, %29 ], [ %28, %23 ], [ %22, %17 ], [ %16, %11 ], [ %10, %5 ]
ret i32 %32
}