#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 /*<<< orphan*/ MFRC522_Clear_Bit(int, int);
int MFRC522_Rd(int);
int /*<<< orphan*/ MFRC522_Set_Bit(int, int);
int /*<<< orphan*/ MFRC522_Wr(int, char);
char MFRC522_ToCard(char command, char *sendData, char sendLen, char *backData,
                    unsigned *backLen) {
  char _status = 2;
  char irqEn = 0x00;
  char waitIRq = 0x00;
  char lastBits;
  char n;
  unsigned i;
  switch (command) {
  case 0x0E: {
    irqEn = 0x12;
    waitIRq = 0x10;
    break;
  }
  case 0x0C: {
    irqEn = 0x77;
    waitIRq = 0x30;
    break;
  }
  default:
    break;
  }
  MFRC522_Wr(0x02, irqEn | 0x80);
  MFRC522_Clear_Bit(0x04, 0x80);
  MFRC522_Set_Bit(0x0A, 0x80);
  MFRC522_Wr(0x01, 0x00);
  for (i = 0; i < sendLen; i++) {
    MFRC522_Wr(0x09, sendData[i]);
  }
  MFRC522_Wr(0x01, command);
  if (command == 0x0C) {
    MFRC522_Set_Bit(0x0D, 0x80);
  }
  i = 0xFFFF;
  do {
    n = MFRC522_Rd(0x04);
    i--;
  } while (i && !(n & 0x01) && !(n & waitIRq));
  MFRC522_Clear_Bit(0x0D, 0x80);
  if (i != 0) {
    if (!(MFRC522_Rd(0x06) & 0x1B)) {
      _status = 0;
      if (n & irqEn & 0x01) {
        _status = 1;
      }
      if (command == 0x0C) {
        n = MFRC522_Rd(0x0A);
        lastBits = MFRC522_Rd(0x0C) & 0x07;
        if (lastBits) {
          *backLen = (n - 1) * 8 + lastBits;
        } else {
          *backLen = n * 8;
        }
        if (n == 0) {
          n = 1;
        }
        if (n > 16) {
          n = 16;
        }
        for (i = 0; i < n; i++) {
          backData[i] = MFRC522_Rd(0x09);
        }
        backData[i] = 0;
      }
    } else {
      _status = 2;
    }
  }
  return _status;
}


x86 assembly (clang, -O0):
<MFRC522_ToCard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dl,%al
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movb   $0x2,-0x29(%rbp)
movb   $0x0,-0x2a(%rbp)
movb   $0x0,-0x2b(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x38(%rbp)
sub    $0xc,%eax
je     119e <MFRC522_ToCard+0x5e>
jmp    1180 <MFRC522_ToCard+0x40>
mov    -0x38(%rbp),%eax
sub    $0xe,%eax
jne    11ab <MFRC522_ToCard+0x6b>
jmp    1191 <MFRC522_ToCard+0x51>
movb   $0x12,-0x2a(%rbp)
movb   $0x10,-0x2b(%rbp)
jmp    11b0 <MFRC522_ToCard+0x70>
movb   $0x77,-0x2a(%rbp)
movb   $0x30,-0x2b(%rbp)
jmp    11b0 <MFRC522_ToCard+0x70>
jmp    11b0 <MFRC522_ToCard+0x70>
movsbl -0x2a(%rbp),%eax
or     $0x80,%eax
mov    $0x2,%edi
movsbl %al,%esi
call   1050 <MFRC522_Wr@plt>
mov    $0x4,%edi
mov    $0x80,%esi
call   1040 <MFRC522_Clear_Bit@plt>
mov    $0xa,%edi
mov    $0x80,%esi
call   1030 <MFRC522_Set_Bit@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <MFRC522_Wr@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jae    1229 <MFRC522_ToCard+0xe9>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    $0x9,%edi
movsbl (%rax,%rcx,1),%esi
call   1050 <MFRC522_Wr@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11f7 <MFRC522_ToCard+0xb7>
mov    $0x1,%edi
movsbl -0x1(%rbp),%esi
call   1050 <MFRC522_Wr@plt>
movsbl -0x1(%rbp),%eax
cmp    $0xc,%eax
jne    1253 <MFRC522_ToCard+0x113>
mov    $0xd,%edi
mov    $0x80,%esi
call   1030 <MFRC522_Set_Bit@plt>
movl   $0xffff,-0x34(%rbp)
mov    $0x4,%edi
call   1060 <MFRC522_Rd@plt>
mov    %al,-0x2d(%rbp)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x34(%rbp)
mov    %al,-0x39(%rbp)
je     12a9 <MFRC522_ToCard+0x169>
movsbl -0x2d(%rbp),%ecx
and    $0x1,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x39(%rbp)
jne    12a9 <MFRC522_ToCard+0x169>
movsbl -0x2d(%rbp),%eax
movsbl -0x2b(%rbp),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    125a <MFRC522_ToCard+0x11a>
mov    $0xd,%edi
mov    $0x80,%esi
call   1040 <MFRC522_Clear_Bit@plt>
cmpl   $0x0,-0x34(%rbp)
je     13d2 <MFRC522_ToCard+0x292>
mov    $0x6,%edi
call   1060 <MFRC522_Rd@plt>
and    $0x1b,%eax
cmp    $0x0,%eax
jne    13c9 <MFRC522_ToCard+0x289>
movb   $0x0,-0x29(%rbp)
movsbl -0x2d(%rbp),%eax
movsbl -0x2a(%rbp),%ecx
and    %ecx,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1301 <MFRC522_ToCard+0x1c1>
movb   $0x1,-0x29(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0xc,%eax
jne    13c4 <MFRC522_ToCard+0x284>
mov    $0xa,%edi
call   1060 <MFRC522_Rd@plt>
mov    %al,-0x2d(%rbp)
mov    $0xc,%edi
call   1060 <MFRC522_Rd@plt>
and    $0x7,%eax
mov    %al,-0x2c(%rbp)
cmpb   $0x0,-0x2c(%rbp)
je     1350 <MFRC522_ToCard+0x210>
movsbl -0x2d(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x3,%ecx
movsbl -0x2c(%rbp),%eax
add    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    135d <MFRC522_ToCard+0x21d>
movsbl -0x2d(%rbp),%ecx
shl    $0x3,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movsbl -0x2d(%rbp),%eax
cmp    $0x0,%eax
jne    136e <MFRC522_ToCard+0x22e>
movb   $0x1,-0x2d(%rbp)
movsbl -0x2d(%rbp),%eax
cmp    $0x10,%eax
jle    137f <MFRC522_ToCard+0x23f>
movb   $0x10,-0x2d(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
movsbl -0x2d(%rbp),%ecx
cmp    %ecx,%eax
jae    13b9 <MFRC522_ToCard+0x279>
mov    $0x9,%edi
call   1060 <MFRC522_Rd@plt>
mov    %al,%dl
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1386 <MFRC522_ToCard+0x246>
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
jmp    13cd <MFRC522_ToCard+0x28d>
movb   $0x2,-0x29(%rbp)
jmp    13d2 <MFRC522_ToCard+0x292>
movsbl -0x29(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MFRC522_ToCard>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %rsi,%r15
mov    %edi,%r12d
cmp    $0xc,%edi
mov    %rcx,0x8(%rsp)
mov    %r8,0x10(%rsp)
je     1182 <MFRC522_ToCard+0x42>
xor    %r13d,%r13d
mov    $0x0,%r14d
cmp    $0xe,%r12d
jne    118e <MFRC522_ToCard+0x4e>
mov    $0x10,%r14d
mov    $0x12,%r13d
jmp    118e <MFRC522_ToCard+0x4e>
mov    $0x30,%r14d
mov    $0x77,%r13d
lea    -0x80(%r13),%eax
movsbl %al,%esi
mov    $0x2,%edi
call   1050 <MFRC522_Wr@plt>
mov    $0x4,%edi
mov    $0x80,%esi
call   1040 <MFRC522_Clear_Bit@plt>
mov    $0xa,%edi
mov    $0x80,%esi
call   1030 <MFRC522_Set_Bit@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <MFRC522_Wr@plt>
test   %bpl,%bpl
je     11f8 <MFRC522_ToCard+0xb8>
movsbq %bpl,%rax
mov    %eax,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%esi
mov    $0x9,%edi
call   1050 <MFRC522_Wr@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11e0 <MFRC522_ToCard+0xa0>
movsbl %r12b,%ebx
mov    $0x1,%edi
mov    %ebx,%esi
call   1050 <MFRC522_Wr@plt>
cmp    $0xc,%bl
jne    121c <MFRC522_ToCard+0xdc>
mov    $0xd,%edi
mov    $0x80,%esi
call   1030 <MFRC522_Set_Bit@plt>
mov    $0xffff0002,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%r15d
mov    $0x4,%edi
call   1060 <MFRC522_Rd@plt>
mov    %eax,%ebp
test   %r15d,%r15d
je     1258 <MFRC522_ToCard+0x118>
mov    %ebp,%eax
and    $0x1,%eax
jne    1258 <MFRC522_ToCard+0x118>
mov    %ebp,%ecx
and    %r14d,%ecx
lea    0x1(%r15),%eax
test   %ecx,%ecx
je     1230 <MFRC522_ToCard+0xf0>
mov    $0xd,%edi
mov    $0x80,%esi
call   1040 <MFRC522_Clear_Bit@plt>
mov    $0x2,%r14b
test   %r15d,%r15d
je     1327 <MFRC522_ToCard+0x1e7>
mov    $0x6,%edi
call   1060 <MFRC522_Rd@plt>
test   $0x1b,%al
jne    1327 <MFRC522_ToCard+0x1e7>
and    %r13d,%ebp
mov    %ebp,%r14d
and    $0x1,%r14b
cmp    $0xc,%r12b
jne    1327 <MFRC522_ToCard+0x1e7>
mov    $0xa,%edi
call   1060 <MFRC522_Rd@plt>
mov    %eax,%ebp
mov    $0xc,%edi
call   1060 <MFRC522_Rd@plt>
movsbl %bpl,%ecx
lea    0x0(,%rcx,8),%edx
mov    %eax,%esi
and    $0x7,%esi
test   $0x7,%al
lea    -0x8(%rsi,%rcx,8),%eax
cmove  %edx,%eax
mov    0x10(%rsp),%rdx
mov    %eax,(%rdx)
test   %cl,%cl
mov    $0x1,%ecx
cmovne %ebp,%ecx
cmp    $0x10,%cl
mov    $0x10,%eax
cmovl  %ecx,%eax
test   %al,%al
je     1319 <MFRC522_ToCard+0x1d9>
movsbl %al,%r15d
xor    %ebx,%ebx
mov    0x8(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x9,%edi
call   1060 <MFRC522_Rd@plt>
mov    %al,0x0(%rbp,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1300 <MFRC522_ToCard+0x1c0>
jmp    1321 <MFRC522_ToCard+0x1e1>
xor    %r15d,%r15d
mov    0x8(%rsp),%rbp
movb   $0x0,0x0(%rbp,%r15,1)
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define signext i8 @MFRC522_ToCard(i8 signext %0, i8* nocapture %1, i8 signext %2, i8* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = sext i8 %0 to i32
switch i32 %6, label %9 [
i32 14, label %7
i32 12, label %8
]
7: ; preds = %5
br label %9
8: ; preds = %5
br label %9
9: ; preds = %5, %8, %7
%10 = phi i32 [ 0, %5 ], [ 119, %8 ], [ 18, %7 ]
%11 = phi i32 [ 0, %5 ], [ 48, %8 ], [ 16, %7 ]
%12 = trunc i32 %10 to i8
%13 = or i8 %12, -128
%14 = tail call i32 @MFRC522_Wr(i32 2, i8 signext %13)
%15 = tail call i32 @MFRC522_Clear_Bit(i32 4, i32 128)
%16 = tail call i32 @MFRC522_Set_Bit(i32 10, i32 128)
%17 = tail call i32 @MFRC522_Wr(i32 1, i8 signext 0)
%18 = icmp eq i8 %2, 0
br i1 %18, label %29, label %19
19: ; preds = %9
%20 = sext i8 %2 to i64
%21 = and i64 %20, 4294967295
br label %22
22: ; preds = %19, %22
%23 = phi i64 [ 0, %19 ], [ %27, %22 ]
%24 = getelementptr inbounds i8, i8* %1, i64 %23
%25 = load i8, i8* %24
%26 = tail call i32 @MFRC522_Wr(i32 9, i8 signext %25)
%27 = add nuw nsw i64 %23, 1
%28 = icmp eq i64 %27, %21
br i1 %28, label %29, label %22
29: ; preds = %22, %9
%30 = tail call i32 @MFRC522_Wr(i32 1, i8 signext %0)
%31 = icmp eq i8 %0, 12
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 @MFRC522_Set_Bit(i32 13, i32 128)
br label %34
34: ; preds = %32, %29
br label %35
35: ; preds = %34, %35
%36 = phi i32 [ %38, %35 ], [ 65535, %34 ]
%37 = tail call i32 @MFRC522_Rd(i32 4)
%38 = add i32 %36, -1
%39 = icmp eq i32 %38, 0
%40 = xor i1 %39, true
%41 = and i32 %37, 1
%42 = icmp eq i32 %41, 0
%43 = select i1 %40, i1 %42, i1 false
%44 = and i32 %37, %11
%45 = icmp eq i32 %44, 0
%46 = select i1 %43, i1 %45, i1 false
br i1 %46, label %35, label %47
47: ; preds = %35
%48 = tail call i32 @MFRC522_Clear_Bit(i32 13, i32 128)
br i1 %39, label %91, label %49
49: ; preds = %47
%50 = tail call i32 @MFRC522_Rd(i32 6)
%51 = and i32 %50, 27
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %91
53: ; preds = %49
%54 = and i32 %37, %10
%55 = trunc i32 %54 to i8
%56 = and i8 %55, 1
br i1 %31, label %57, label %91
57: ; preds = %53
%58 = tail call i32 @MFRC522_Rd(i32 10)
%59 = trunc i32 %58 to i8
%60 = tail call i32 @MFRC522_Rd(i32 12)
%61 = trunc i32 %60 to i8
%62 = and i8 %61, 7
%63 = icmp eq i8 %62, 0
%64 = shl i32 %58, 24
%65 = ashr exact i32 %64, 21
%66 = add nsw i32 %65, -8
%67 = zext i8 %62 to i32
%68 = or i32 %66, %67
%69 = select i1 %63, i32 %65, i32 %68
store i32 %69, i32* %4
%70 = and i32 %58, 255
%71 = icmp eq i32 %70, 0
%72 = select i1 %71, i8 1, i8 %59
%73 = icmp slt i8 %72, 16
%74 = select i1 %73, i8 %72, i8 16
%75 = icmp eq i8 %74, 0
br i1 %75, label %88, label %76
76: ; preds = %57
%77 = sext i8 %74 to i32
%78 = zext i32 %77 to i64
br label %79
79: ; preds = %76, %79
%80 = phi i64 [ 0, %76 ], [ %84, %79 ]
%81 = tail call i32 @MFRC522_Rd(i32 9)
%82 = trunc i32 %81 to i8
%83 = getelementptr inbounds i8, i8* %3, i64 %80
store i8 %82, i8* %83
%84 = add nuw nsw i64 %80, 1
%85 = icmp eq i64 %84, %78
br i1 %85, label %86, label %79
86: ; preds = %79
%87 = zext i32 %77 to i64
br label %88
88: ; preds = %57, %86
%89 = phi i64 [ %87, %86 ], [ 0, %57 ]
%90 = getelementptr inbounds i8, i8* %3, i64 %89
store i8 0, i8* %90
br label %91
91: ; preds = %49, %88, %53, %47
%92 = phi i8 [ %56, %88 ], [ %56, %53 ], [ 2, %47 ], [ 2, %49 ]
ret i8 %92
}