#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 iCvmEnterOnlinePin();
int iCvmVerifyHolderId();
int iCvmVerifyOfflinePlainPin();
int /*<<< orphan*/ iEmvSetItemBit(int, int, int);
int iEmvTermEnvironment();
int /*<<< orphan*/ iEmvTestItemBit(int, int);
int iCvmDoVerify(unsigned char *psCvmResult, int *piNeedSignFlag) {
  int iRet;
  int iCvmRecognisedFlag;
  int iCvmSupportFlag;
  int iCvmPassFlag;
  iCvmSupportFlag = 0;
  *piNeedSignFlag = 0;
  iCvmRecognisedFlag = 1;
  iCvmPassFlag = 0;
  switch (psCvmResult[0] & 0x3F) {
  case 0:
    iCvmSupportFlag = 1;
    psCvmResult[2] = 1;
    break;
  case 1:
    if (iEmvTestItemBit(4, 8) == 0)
      break;
    iCvmSupportFlag = 1;
    iRet = iCvmVerifyOfflinePlainPin();
    if (iRet == 0) {
      iCvmPassFlag = 1;
      psCvmResult[2] = 2;
      break;
    }
    if (iRet == -1) {
      psCvmResult[2] = 1;
      break;
    }
    return (iRet);
  case 3:
    if (iEmvTestItemBit(4, 8) == 0)
      break;
    if (iEmvTestItemBit(4, 10) == 0)
      break;
    *piNeedSignFlag = 1;
    iCvmSupportFlag = 1;
    iRet = iCvmVerifyOfflinePlainPin();
    if (iRet == 0) {
      iCvmPassFlag = 1;
      psCvmResult[2] = 0;
      break;
    }
    if (iRet == -1) {
      psCvmResult[2] = 1;
      break;
    }
    return (iRet);
  case 2:
    if (iEmvTestItemBit(4, 9) == 0)
      break;
    iCvmSupportFlag = 1;
    iRet = iCvmEnterOnlinePin();
    if (iRet == 0) {
      iCvmPassFlag = 1;
      psCvmResult[2] = 0;
      iEmvSetItemBit(2, 21, 1);
      break;
    }
    if (iRet == 1) {
      psCvmResult[2] = 1;
      break;
    }
    return (iRet);
    break;
  case 4:
    if (iEmvTestItemBit(4, 11) == 0)
      break;
    break;
  case 5:
    if (iEmvTestItemBit(4, 11) == 0)
      break;
    if (iEmvTestItemBit(4, 10) == 0)
      break;
    *piNeedSignFlag = 1;
    break;
  case 0x1E:
    if (iEmvTestItemBit(4, 10) == 0)
      break;
    iCvmSupportFlag = 1;
    *piNeedSignFlag = 1;
    psCvmResult[2] = 0;
    iCvmPassFlag = 1;
    break;
  case 0x1F:
    if (iEmvTestItemBit(4, 12) == 0)
      break;
    iCvmSupportFlag = 1;
    psCvmResult[2] = 2;
    iCvmPassFlag = 1;
    break;
  case 0x20:
    if (iEmvTestItemBit(4, 15) == 0)
      break;
    if (iEmvTermEnvironment() != 1)
      break;
    iCvmSupportFlag = 1;
    iRet = iCvmVerifyHolderId();
    if (iRet == 0) {
      iCvmPassFlag = 1;
      psCvmResult[2] = 2;
      break;
    }
    if (iRet == -1) {
      psCvmResult[2] = 1;
      break;
    }
    return (iRet);
    break;
  default:
    iCvmRecognisedFlag = 0;
    break;
  }
  if (iCvmRecognisedFlag == 0) {
    iEmvSetItemBit(2, 17, 1);
    return (-1);
  }
  if (iCvmSupportFlag == 0) {
    return (-2);
  }
  if (iCvmPassFlag == 0) {
    return (-3);
  }
  return (0);
}


x86 assembly (clang, -O0):
<iCvmDoVerify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x1,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x3f,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x20,%eax
ja     14bd <iCvmDoVerify+0x35d>
mov    -0x30(%rbp),%rax
lea    0xe4d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x1,0x2(%rax)
jmp    14c4 <iCvmDoVerify+0x364>
mov    $0x4,%edi
mov    $0x8,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    11ed <iCvmDoVerify+0x8d>
jmp    14c4 <iCvmDoVerify+0x364>
movl   $0x1,-0x24(%rbp)
mov    $0x0,%al
call   1080 <iCvmVerifyOfflinePlainPin@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    121c <iCvmDoVerify+0xbc>
movl   $0x1,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x2,0x2(%rax)
jmp    14c4 <iCvmDoVerify+0x364>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1233 <iCvmDoVerify+0xd3>
mov    -0x10(%rbp),%rax
movb   $0x1,0x2(%rax)
jmp    14c4 <iCvmDoVerify+0x364>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1521 <iCvmDoVerify+0x3c1>
mov    $0x4,%edi
mov    $0x8,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    125b <iCvmDoVerify+0xfb>
jmp    14c4 <iCvmDoVerify+0x364>
mov    $0x4,%edi
mov    $0xa,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    1278 <iCvmDoVerify+0x118>
jmp    14c4 <iCvmDoVerify+0x364>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x1,-0x24(%rbp)
mov    $0x0,%al
call   1080 <iCvmVerifyOfflinePlainPin@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    12b1 <iCvmDoVerify+0x151>
movl   $0x1,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,0x2(%rax)
jmp    14c4 <iCvmDoVerify+0x364>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    12c8 <iCvmDoVerify+0x168>
mov    -0x10(%rbp),%rax
movb   $0x1,0x2(%rax)
jmp    14c4 <iCvmDoVerify+0x364>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1521 <iCvmDoVerify+0x3c1>
mov    $0x4,%edi
mov    $0x9,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    12f0 <iCvmDoVerify+0x190>
jmp    14c4 <iCvmDoVerify+0x364>
movl   $0x1,-0x24(%rbp)
mov    $0x0,%al
call   1040 <iCvmEnterOnlinePin@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1333 <iCvmDoVerify+0x1d3>
movl   $0x1,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    $0x2,%edi
mov    $0x15,%esi
mov    $0x1,%edx
call   1060 <iEmvSetItemBit@plt>
jmp    14c4 <iCvmDoVerify+0x364>
cmpl   $0x1,-0x1c(%rbp)
jne    134a <iCvmDoVerify+0x1ea>
mov    -0x10(%rbp),%rax
movb   $0x1,0x2(%rax)
jmp    14c4 <iCvmDoVerify+0x364>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1521 <iCvmDoVerify+0x3c1>
mov    $0x4,%edi
mov    $0xb,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    1372 <iCvmDoVerify+0x212>
jmp    14c4 <iCvmDoVerify+0x364>
jmp    14c4 <iCvmDoVerify+0x364>
mov    $0x4,%edi
mov    $0xb,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    1394 <iCvmDoVerify+0x234>
jmp    14c4 <iCvmDoVerify+0x364>
mov    $0x4,%edi
mov    $0xa,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    13b1 <iCvmDoVerify+0x251>
jmp    14c4 <iCvmDoVerify+0x364>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    14c4 <iCvmDoVerify+0x364>
mov    $0x4,%edi
mov    $0xa,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    13dd <iCvmDoVerify+0x27d>
jmp    14c4 <iCvmDoVerify+0x364>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x2(%rax)
movl   $0x1,-0x28(%rbp)
jmp    14c4 <iCvmDoVerify+0x364>
mov    $0x4,%edi
mov    $0xc,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    141f <iCvmDoVerify+0x2bf>
jmp    14c4 <iCvmDoVerify+0x364>
movl   $0x1,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x2,0x2(%rax)
movl   $0x1,-0x28(%rbp)
jmp    14c4 <iCvmDoVerify+0x364>
mov    $0x4,%edi
mov    $0xf,%esi
call   1030 <iEmvTestItemBit@plt>
cmp    $0x0,%eax
jne    1457 <iCvmDoVerify+0x2f7>
jmp    14c4 <iCvmDoVerify+0x364>
mov    $0x0,%al
call   1070 <iEmvTermEnvironment@plt>
cmp    $0x1,%eax
je     146c <iCvmDoVerify+0x30c>
jmp    14c4 <iCvmDoVerify+0x364>
movl   $0x1,-0x24(%rbp)
mov    $0x0,%al
call   1050 <iCvmVerifyHolderId@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    149b <iCvmDoVerify+0x33b>
movl   $0x1,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x2,0x2(%rax)
jmp    14c4 <iCvmDoVerify+0x364>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    14b2 <iCvmDoVerify+0x352>
mov    -0x10(%rbp),%rax
movb   $0x1,0x2(%rax)
jmp    14c4 <iCvmDoVerify+0x364>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1521 <iCvmDoVerify+0x3c1>
movl   $0x0,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    14ee <iCvmDoVerify+0x38e>
mov    $0x2,%edi
mov    $0x11,%esi
mov    $0x1,%edx
call   1060 <iEmvSetItemBit@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1521 <iCvmDoVerify+0x3c1>
cmpl   $0x0,-0x24(%rbp)
jne    1504 <iCvmDoVerify+0x3a4>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1521 <iCvmDoVerify+0x3c1>
cmpl   $0x0,-0x28(%rbp)
jne    151a <iCvmDoVerify+0x3ba>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1521 <iCvmDoVerify+0x3c1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iCvmDoVerify>:
push   %rbp
push   %r14
push   %rbx
movl   $0x0,(%rsi)
movzbl (%rdi),%eax
and    $0x3f,%eax
cmp    $0x20,%eax
ja     12c1 <iCvmDoVerify+0x161>
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe7a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x1,0x2(%r14)
mov    $0xfffffffd,%ebp
jmp    1357 <iCvmDoVerify+0x1f7>
mov    $0x4,%edi
mov    $0x8,%esi
call   1030 <iEmvTestItemBit@plt>
test   %eax,%eax
je     130f <iCvmDoVerify+0x1af>
xor    %eax,%eax
call   1080 <iCvmVerifyOfflinePlainPin@plt>
cmp    $0xffffffff,%eax
jne    134a <iCvmDoVerify+0x1ea>
jmp    118f <iCvmDoVerify+0x2f>
mov    $0x4,%edi
mov    $0x9,%esi
call   1030 <iEmvTestItemBit@plt>
test   %eax,%eax
je     130f <iCvmDoVerify+0x1af>
xor    %eax,%eax
call   1040 <iCvmEnterOnlinePin@plt>
cmp    $0x1,%eax
je     118f <iCvmDoVerify+0x2f>
mov    %eax,%ebp
test   %eax,%eax
jne    1357 <iCvmDoVerify+0x1f7>
movb   $0x0,0x2(%r14)
mov    $0x2,%edi
mov    $0x15,%esi
mov    $0x1,%edx
call   1060 <iEmvSetItemBit@plt>
jmp    1355 <iCvmDoVerify+0x1f5>
mov    $0x4,%edi
mov    $0x8,%esi
call   1030 <iEmvTestItemBit@plt>
mov    $0xfffffffe,%ebp
test   %eax,%eax
je     1357 <iCvmDoVerify+0x1f7>
mov    $0x4,%edi
mov    $0xa,%esi
call   1030 <iEmvTestItemBit@plt>
test   %eax,%eax
je     1357 <iCvmDoVerify+0x1f7>
movl   $0x1,(%rbx)
xor    %eax,%eax
call   1080 <iCvmVerifyOfflinePlainPin@plt>
cmp    $0xffffffff,%eax
je     118f <iCvmDoVerify+0x2f>
mov    %eax,%ebp
test   %eax,%eax
je     12f5 <iCvmDoVerify+0x195>
jmp    1357 <iCvmDoVerify+0x1f7>
mov    $0x4,%edi
mov    $0xb,%esi
call   1030 <iEmvTestItemBit@plt>
mov    $0xfffffffe,%ebp
jmp    1357 <iCvmDoVerify+0x1f7>
mov    $0x4,%edi
mov    $0xb,%esi
call   1030 <iEmvTestItemBit@plt>
mov    $0xfffffffe,%ebp
test   %eax,%eax
je     1357 <iCvmDoVerify+0x1f7>
mov    $0x4,%edi
mov    $0xa,%esi
call   1030 <iEmvTestItemBit@plt>
test   %eax,%eax
je     1357 <iCvmDoVerify+0x1f7>
movl   $0x1,(%rbx)
jmp    1357 <iCvmDoVerify+0x1f7>
mov    $0x2,%edi
mov    $0x11,%esi
mov    $0x1,%edx
call   1060 <iEmvSetItemBit@plt>
mov    $0xffffffff,%ebp
jmp    1357 <iCvmDoVerify+0x1f7>
mov    $0x4,%edi
mov    $0xa,%esi
call   1030 <iEmvTestItemBit@plt>
test   %eax,%eax
je     130f <iCvmDoVerify+0x1af>
movl   $0x1,(%rbx)
movb   $0x0,0x2(%r14)
jmp    1355 <iCvmDoVerify+0x1f5>
mov    $0x4,%edi
mov    $0xc,%esi
call   1030 <iEmvTestItemBit@plt>
test   %eax,%eax
jne    1350 <iCvmDoVerify+0x1f0>
mov    $0xfffffffe,%ebp
jmp    1357 <iCvmDoVerify+0x1f7>
mov    $0x4,%edi
mov    $0xf,%esi
call   1030 <iEmvTestItemBit@plt>
mov    $0xfffffffe,%ebp
test   %eax,%eax
je     1357 <iCvmDoVerify+0x1f7>
xor    %eax,%eax
call   1070 <iEmvTermEnvironment@plt>
cmp    $0x1,%eax
jne    1357 <iCvmDoVerify+0x1f7>
xor    %eax,%eax
call   1050 <iCvmVerifyHolderId@plt>
cmp    $0xffffffff,%eax
je     118f <iCvmDoVerify+0x2f>
mov    %eax,%ebp
test   %eax,%eax
jne    1357 <iCvmDoVerify+0x1f7>
movb   $0x2,0x2(%r14)
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @iCvmDoVerify(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 0, i32* %8
%10 = load i32*, i32** %5
store i32 0, i32* %10
store i32 1, i32* %7
store i32 0, i32* %9
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = and i32 %14, 63
switch i32 %15, label %135 [
i32 0, label %16
i32 1, label %19
i32 3, label %38
i32 2, label %62
i32 4, label %82
i32 5, label %87
i32 30, label %97
i32 31, label %105
i32 32, label %112
]
16: ; preds = %2
store i32 1, i32* %8
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 2
store i8 1, i8* %18
br label %136
19: ; preds = %2
%20 = call i32 @iEmvTestItemBit(i32 4, i32 8)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
br label %136
23: ; preds = %19
store i32 1, i32* %8
%24 = call i32 (...) @iCvmVerifyOfflinePlainPin()
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23
store i32 1, i32* %9
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i64 2
store i8 2, i8* %29
br label %136
30: ; preds = %23
%31 = load i32, i32* %6
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i64 2
store i8 1, i8* %35
br label %136
36: ; preds = %30
%37 = load i32, i32* %6
store i32 %37, i32* %3
br label %150
38: ; preds = %2
%39 = call i32 @iEmvTestItemBit(i32 4, i32 8)
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %38
br label %136
42: ; preds = %38
%43 = call i32 @iEmvTestItemBit(i32 4, i32 10)
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %42
br label %136
46: ; preds = %42
%47 = load i32*, i32** %5
store i32 1, i32* %47
store i32 1, i32* %8
%48 = call i32 (...) @iCvmVerifyOfflinePlainPin()
store i32 %48, i32* %6
%49 = load i32, i32* %6
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %46
store i32 1, i32* %9
%52 = load i8*, i8** %4
%53 = getelementptr inbounds i8, i8* %52, i64 2
store i8 0, i8* %53
br label %136
54: ; preds = %46
%55 = load i32, i32* %6
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i64 2
store i8 1, i8* %59
br label %136
60: ; preds = %54
%61 = load i32, i32* %6
store i32 %61, i32* %3
br label %150
62: ; preds = %2
%63 = call i32 @iEmvTestItemBit(i32 4, i32 9)
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %62
br label %136
66: ; preds = %62
store i32 1, i32* %8
%67 = call i32 (...) @iCvmEnterOnlinePin()
store i32 %67, i32* %6
%68 = load i32, i32* %6
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %74
70: ; preds = %66
store i32 1, i32* %9
%71 = load i8*, i8** %4
%72 = getelementptr inbounds i8, i8* %71, i64 2
store i8 0, i8* %72
%73 = call i32 @iEmvSetItemBit(i32 2, i32 21, i32 1)
br label %136
74: ; preds = %66
%75 = load i32, i32* %6
%76 = icmp eq i32 %75, 1
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = load i8*, i8** %4
%79 = getelementptr inbounds i8, i8* %78, i64 2
store i8 1, i8* %79
br label %136
80: ; preds = %74
%81 = load i32, i32* %6
store i32 %81, i32* %3
br label %150
82: ; preds = %2
%83 = call i32 @iEmvTestItemBit(i32 4, i32 11)
%84 = icmp eq i32 %83, 0
br i1 %84, label %85, label %86
85: ; preds = %82
br label %136
86: ; preds = %82
br label %136
87: ; preds = %2
%88 = call i32 @iEmvTestItemBit(i32 4, i32 11)
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %87
br label %136
91: ; preds = %87
%92 = call i32 @iEmvTestItemBit(i32 4, i32 10)
%93 = icmp eq i32 %92, 0
br i1 %93, label %94, label %95
94: ; preds = %91
br label %136
95: ; preds = %91
%96 = load i32*, i32** %5
store i32 1, i32* %96
br label %136
97: ; preds = %2
%98 = call i32 @iEmvTestItemBit(i32 4, i32 10)
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %101
100: ; preds = %97
br label %136
101: ; preds = %97
store i32 1, i32* %8
%102 = load i32*, i32** %5
store i32 1, i32* %102
%103 = load i8*, i8** %4
%104 = getelementptr inbounds i8, i8* %103, i64 2
store i8 0, i8* %104
store i32 1, i32* %9
br label %136
105: ; preds = %2
%106 = call i32 @iEmvTestItemBit(i32 4, i32 12)
%107 = icmp eq i32 %106, 0
br i1 %107, label %108, label %109
108: ; preds = %105
br label %136
109: ; preds = %105
store i32 1, i32* %8
%110 = load i8*, i8** %4
%111 = getelementptr inbounds i8, i8* %110, i64 2
store i8 2, i8* %111
store i32 1, i32* %9
br label %136
112: ; preds = %2
%113 = call i32 @iEmvTestItemBit(i32 4, i32 15)
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %116
115: ; preds = %112
br label %136
116: ; preds = %112
%117 = call i32 (...) @iEmvTermEnvironment()
%118 = icmp ne i32 %117, 1
br i1 %118, label %119, label %120
119: ; preds = %116
br label %136
120: ; preds = %116
store i32 1, i32* %8
%121 = call i32 (...) @iCvmVerifyHolderId()
store i32 %121, i32* %6
%122 = load i32, i32* %6
%123 = icmp eq i32 %122, 0
br i1 %123, label %124, label %127
124: ; preds = %120
store i32 1, i32* %9
%125 = load i8*, i8** %4
%126 = getelementptr inbounds i8, i8* %125, i64 2
store i8 2, i8* %126
br label %136
127: ; preds = %120
%128 = load i32, i32* %6
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %133
130: ; preds = %127
%131 = load i8*, i8** %4
%132 = getelementptr inbounds i8, i8* %131, i64 2
store i8 1, i8* %132
br label %136
133: ; preds = %127
%134 = load i32, i32* %6
store i32 %134, i32* %3
br label %150
135: ; preds = %2
store i32 0, i32* %7
br label %136
136: ; preds = %135, %130, %124, %119, %115, %109, %108, %101, %100, %95, %94, %90, %86, %85, %77, %70, %65, %57, %51, %45, %41, %33, %27, %22, %16
%137 = load i32, i32* %7
%138 = icmp eq i32 %137, 0
br i1 %138, label %139, label %141
139: ; preds = %136
%140 = call i32 @iEmvSetItemBit(i32 2, i32 17, i32 1)
store i32 -1, i32* %3
br label %150
141: ; preds = %136
%142 = load i32, i32* %8
%143 = icmp eq i32 %142, 0
br i1 %143, label %144, label %145
144: ; preds = %141
store i32 -2, i32* %3
br label %150
145: ; preds = %141
%146 = load i32, i32* %9
%147 = icmp eq i32 %146, 0
br i1 %147, label %148, label %149
148: ; preds = %145
store i32 -3, i32* %3
br label %150
149: ; preds = %145
store i32 0, i32* %3
br label %150
150: ; preds = %149, %148, %144, %139, %133, %80, %60, %36
%151 = load i32, i32* %3
ret i32 %151
}

LLVM IR (-O2):
define i32 @iCvmDoVerify(i8* nocapture %0, i32* nocapture writeonly %1) {
store i32 0, i32* %1
%3 = load i8, i8* %0
%4 = and i8 %3, 63
%5 = zext i8 %4 to i32
switch i32 %5, label %70 [
i32 0, label %6
i32 1, label %8
i32 3, label %17
i32 2, label %29
i32 4, label %39
i32 5, label %41
i32 30, label %48
i32 31, label %53
i32 32, label %58
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %0, i64 2
store i8 1, i8* %7
br label %72
8: ; preds = %2
%9 = tail call i32 @iEmvTestItemBit(i32 4, i32 8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %72, label %11
11: ; preds = %8
%12 = tail call i32 (...) @iCvmVerifyOfflinePlainPin()
switch i32 %12, label %72 [
i32 0, label %13
i32 -1, label %15
]
13: ; preds = %11
%14 = getelementptr inbounds i8, i8* %0, i64 2
store i8 2, i8* %14
br label %72
15: ; preds = %11
%16 = getelementptr inbounds i8, i8* %0, i64 2
store i8 1, i8* %16
br label %72
17: ; preds = %2
%18 = tail call i32 @iEmvTestItemBit(i32 4, i32 8)
%19 = icmp eq i32 %18, 0
br i1 %19, label %72, label %20
20: ; preds = %17
%21 = tail call i32 @iEmvTestItemBit(i32 4, i32 10)
%22 = icmp eq i32 %21, 0
br i1 %22, label %72, label %23
23: ; preds = %20
store i32 1, i32* %1
%24 = tail call i32 (...) @iCvmVerifyOfflinePlainPin()
switch i32 %24, label %72 [
i32 0, label %25
i32 -1, label %27
]
25: ; preds = %23
%26 = getelementptr inbounds i8, i8* %0, i64 2
store i8 0, i8* %26
br label %72
27: ; preds = %23
%28 = getelementptr inbounds i8, i8* %0, i64 2
store i8 1, i8* %28
br label %72
29: ; preds = %2
%30 = tail call i32 @iEmvTestItemBit(i32 4, i32 9)
%31 = icmp eq i32 %30, 0
br i1 %31, label %72, label %32
32: ; preds = %29
%33 = tail call i32 (...) @iCvmEnterOnlinePin()
switch i32 %33, label %72 [
i32 0, label %34
i32 1, label %37
]
34: ; preds = %32
%35 = getelementptr inbounds i8, i8* %0, i64 2
store i8 0, i8* %35
%36 = tail call i32 @iEmvSetItemBit(i32 2, i32 21, i32 1)
br label %72
37: ; preds = %32
%38 = getelementptr inbounds i8, i8* %0, i64 2
store i8 1, i8* %38
br label %72
39: ; preds = %2
%40 = tail call i32 @iEmvTestItemBit(i32 4, i32 11)
br label %72
41: ; preds = %2
%42 = tail call i32 @iEmvTestItemBit(i32 4, i32 11)
%43 = icmp eq i32 %42, 0
br i1 %43, label %72, label %44
44: ; preds = %41
%45 = tail call i32 @iEmvTestItemBit(i32 4, i32 10)
%46 = icmp eq i32 %45, 0
br i1 %46, label %72, label %47
47: ; preds = %44
store i32 1, i32* %1
br label %72
48: ; preds = %2
%49 = tail call i32 @iEmvTestItemBit(i32 4, i32 10)
%50 = icmp eq i32 %49, 0
br i1 %50, label %72, label %51
51: ; preds = %48
store i32 1, i32* %1
%52 = getelementptr inbounds i8, i8* %0, i64 2
store i8 0, i8* %52
br label %72
53: ; preds = %2
%54 = tail call i32 @iEmvTestItemBit(i32 4, i32 12)
%55 = icmp eq i32 %54, 0
br i1 %55, label %72, label %56
56: ; preds = %53
%57 = getelementptr inbounds i8, i8* %0, i64 2
store i8 2, i8* %57
br label %72
58: ; preds = %2
%59 = tail call i32 @iEmvTestItemBit(i32 4, i32 15)
%60 = icmp eq i32 %59, 0
br i1 %60, label %72, label %61
61: ; preds = %58
%62 = tail call i32 (...) @iEmvTermEnvironment()
%63 = icmp eq i32 %62, 1
br i1 %63, label %64, label %72
64: ; preds = %61
%65 = tail call i32 (...) @iCvmVerifyHolderId()
switch i32 %65, label %72 [
i32 0, label %66
i32 -1, label %68
]
66: ; preds = %64
%67 = getelementptr inbounds i8, i8* %0, i64 2
store i8 2, i8* %67
br label %72
68: ; preds = %64
%69 = getelementptr inbounds i8, i8* %0, i64 2
store i8 1, i8* %69
br label %72
70: ; preds = %2
%71 = tail call i32 @iEmvSetItemBit(i32 2, i32 17, i32 1)
br label %72
72: ; preds = %68, %37, %27, %15, %6, %13, %25, %34, %51, %56, %66, %61, %58, %53, %48, %44, %41, %39, %29, %20, %17, %8, %47, %64, %32, %23, %11, %70
%73 = phi i32 [ -1, %70 ], [ %12, %11 ], [ %24, %23 ], [ %33, %32 ], [ %65, %64 ], [ 0, %66 ], [ 0, %56 ], [ 0, %51 ], [ 0, %34 ], [ 0, %25 ], [ 0, %13 ], [ -3, %6 ], [ -3, %15 ], [ -3, %27 ], [ -3, %37 ], [ -3, %68 ], [ -2, %61 ], [ -2, %58 ], [ -2, %53 ], [ -2, %48 ], [ -2, %44 ], [ -2, %41 ], [ -2, %39 ], [ -2, %29 ], [ -2, %20 ], [ -2, %17 ], [ -2, %8 ], [ -2, %47 ]
ret i32 %73
}