#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 */

/* Variables and functions */
int NID_commonName;
int NID_pkcs9_challengePassword;
int NID_pkcs9_emailAddress;
int NID_pkcs9_unstructuredName;
int V_ASN1_IA5STRING;
int V_ASN1_T61STRING;
int fix_data(int nid, int *type) {
  if (nid == NID_pkcs9_emailAddress)
    *type = V_ASN1_IA5STRING;
  if ((nid == NID_commonName) && (*type == V_ASN1_IA5STRING))
    *type = V_ASN1_T61STRING;
  if ((nid == NID_pkcs9_challengePassword) && (*type == V_ASN1_IA5STRING))
    *type = V_ASN1_T61STRING;
  if ((nid == NID_pkcs9_unstructuredName) && (*type == V_ASN1_T61STRING))
    return (0);
  if (nid == NID_pkcs9_unstructuredName)
    *type = V_ASN1_IA5STRING;
  return (1);
}


x86 assembly (clang, -O0):
<fix_data>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ecb(%rip),%rcx
cmp    (%rcx),%eax
jne    112c <fix_data+0x2c>
mov    0x2e9c(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%eax
jne    1162 <fix_data+0x62>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2e75(%rip),%rcx
cmp    (%rcx),%eax
jne    1162 <fix_data+0x62>
mov    0x2e76(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
mov    0x2e4c(%rip),%rcx
cmp    (%rcx),%eax
jne    1198 <fix_data+0x98>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2e3f(%rip),%rcx
cmp    (%rcx),%eax
jne    1198 <fix_data+0x98>
mov    0x2e40(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
mov    0x2e46(%rip),%rcx
cmp    (%rcx),%eax
jne    11cb <fix_data+0xcb>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2e19(%rip),%rcx
cmp    (%rcx),%eax
jne    11cb <fix_data+0xcb>
movl   $0x0,-0x4(%rbp)
jmp    11f3 <fix_data+0xf3>
mov    -0x8(%rbp),%eax
mov    0x2e13(%rip),%rcx
cmp    (%rcx),%eax
jne    11ec <fix_data+0xec>
mov    0x2ddc(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_data>:
mov    0x2ed9(%rip),%rax
cmp    %edi,(%rax)
jne    1116 <fix_data+0x16>
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsi)
mov    0x2eab(%rip),%rax
cmp    %edi,(%rax)
jne    1139 <fix_data+0x39>
mov    (%rsi),%eax
mov    0x2e96(%rip),%rcx
cmp    (%rcx),%eax
jne    1139 <fix_data+0x39>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsi)
mov    0x2e78(%rip),%rax
cmp    %edi,(%rax)
jne    115c <fix_data+0x5c>
mov    (%rsi),%eax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%eax
jne    115c <fix_data+0x5c>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsi)
mov    0x2e85(%rip),%rcx
mov    $0x1,%eax
cmp    %edi,(%rcx)
jne    118b <fix_data+0x8b>
mov    (%rsi),%ecx
mov    0x2e5b(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
je     118b <fix_data+0x8b>
mov    0x2e3e(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
@NID_pkcs9_emailAddress = global i32 0
@V_ASN1_IA5STRING = global i32 0
@NID_commonName = global i32 0
@V_ASN1_T61STRING = global i32 0
@NID_pkcs9_challengePassword = global i32 0
@NID_pkcs9_unstructuredName = global i32 0
define i32 @fix_data(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
%6 = load i32, i32* %4
%7 = load i32, i32* @NID_pkcs9_emailAddress
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* @V_ASN1_IA5STRING
%11 = load i32*, i32** %5
store i32 %10, i32* %11
br label %12
12: ; preds = %9, %2
%13 = load i32, i32* %4
%14 = load i32, i32* @NID_commonName
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32*, i32** %5
%18 = load i32, i32* %17
%19 = load i32, i32* @V_ASN1_IA5STRING
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load i32, i32* @V_ASN1_T61STRING
%23 = load i32*, i32** %5
store i32 %22, i32* %23
br label %24
24: ; preds = %21, %16, %12
%25 = load i32, i32* %4
%26 = load i32, i32* @NID_pkcs9_challengePassword
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %36
28: ; preds = %24
%29 = load i32*, i32** %5
%30 = load i32, i32* %29
%31 = load i32, i32* @V_ASN1_IA5STRING
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load i32, i32* @V_ASN1_T61STRING
%35 = load i32*, i32** %5
store i32 %34, i32* %35
br label %36
36: ; preds = %33, %28, %24
%37 = load i32, i32* %4
%38 = load i32, i32* @NID_pkcs9_unstructuredName
%39 = icmp eq i32 %37, %38
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load i32*, i32** %5
%42 = load i32, i32* %41
%43 = load i32, i32* @V_ASN1_T61STRING
%44 = icmp eq i32 %42, %43
br i1 %44, label %45, label %46
45: ; preds = %40
store i32 0, i32* %3
br label %54
46: ; preds = %40, %36
%47 = load i32, i32* %4
%48 = load i32, i32* @NID_pkcs9_unstructuredName
%49 = icmp eq i32 %47, %48
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = load i32, i32* @V_ASN1_IA5STRING
%52 = load i32*, i32** %5
store i32 %51, i32* %52
br label %53
53: ; preds = %50, %46
store i32 1, i32* %3
br label %54
54: ; preds = %53, %45
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@NID_pkcs9_emailAddress = global i32 0
@V_ASN1_IA5STRING = global i32 0
@NID_commonName = global i32 0
@V_ASN1_T61STRING = global i32 0
@NID_pkcs9_challengePassword = global i32 0
@NID_pkcs9_unstructuredName = global i32 0
define i32 @fix_data(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* @NID_pkcs9_emailAddress
%4 = icmp eq i32 %3, %0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = load i32, i32* @V_ASN1_IA5STRING
store i32 %6, i32* %1
br label %7
7: ; preds = %5, %2
%8 = load i32, i32* @NID_commonName
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i32, i32* %1
%12 = load i32, i32* @V_ASN1_IA5STRING
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32, i32* @V_ASN1_T61STRING
store i32 %15, i32* %1
br label %16
16: ; preds = %14, %10, %7
%17 = load i32, i32* @NID_pkcs9_challengePassword
%18 = icmp eq i32 %17, %0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %1
%21 = load i32, i32* @V_ASN1_IA5STRING
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i32, i32* @V_ASN1_T61STRING
store i32 %24, i32* %1
br label %25
25: ; preds = %23, %19, %16
%26 = load i32, i32* @NID_pkcs9_unstructuredName
%27 = icmp eq i32 %26, %0
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %1
%30 = load i32, i32* @V_ASN1_T61STRING
%31 = icmp eq i32 %29, %30
br i1 %31, label %34, label %32
32: ; preds = %28
%33 = load i32, i32* @V_ASN1_IA5STRING
store i32 %33, i32* %1
br label %34
34: ; preds = %25, %32, %28
%35 = phi i32 [ 0, %28 ], [ 1, %32 ], [ 1, %25 ]
ret i32 %35
}