#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*/ AntennaOn();
unsigned char Read_MFRC522(int);
int /*<<< orphan*/ Write_MFRC522(int, int);
int /*<<< orphan*/ bcm2835_delay(int);
int /*<<< orphan*/ setrst(int);
void MFRC522_Init(void) {
  unsigned char val;
  setrst(0);
  bcm2835_delay(50);
  setrst(1);
  bcm2835_delay(50);
  do {
    val = Read_MFRC522(0x01);
  } while (val & 0b00010000 > 0);
  AntennaOn();
  Write_MFRC522(0x2A, 0x80);
  Write_MFRC522(0x2B, 0xA9);
  Write_MFRC522(0x2D, 0x03);
  Write_MFRC522(0x2C, 0xE8);
  Write_MFRC522(0x15, 0x40);
  Write_MFRC522(0x11, 0x3D);
}


x86 assembly (clang, -O0):
<MFRC522_Init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <setrst@plt>
mov    $0x32,%edi
call   1050 <bcm2835_delay@plt>
mov    $0x1,%edi
call   1040 <setrst@plt>
mov    $0x32,%edi
call   1050 <bcm2835_delay@plt>
mov    $0x1,%edi
call   1030 <Read_MFRC522@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    117d <MFRC522_Init+0x2d>
mov    $0x0,%al
call   1070 <AntennaOn@plt>
mov    $0x2a,%edi
mov    $0x80,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x2b,%edi
mov    $0xa9,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x2d,%edi
mov    $0x3,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x2c,%edi
mov    $0xe8,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x15,%edi
mov    $0x40,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x11,%edi
mov    $0x3d,%esi
call   1060 <Write_MFRC522@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MFRC522_Init>:
push   %rax
xor    %edi,%edi
call   1040 <setrst@plt>
mov    $0x32,%edi
call   1050 <bcm2835_delay@plt>
mov    $0x1,%edi
call   1040 <setrst@plt>
mov    $0x32,%edi
call   1050 <bcm2835_delay@plt>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <Read_MFRC522@plt>
test   $0x1,%al
jne    1180 <MFRC522_Init+0x30>
xor    %eax,%eax
call   1070 <AntennaOn@plt>
mov    $0x2a,%edi
mov    $0x80,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x2b,%edi
mov    $0xa9,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x2d,%edi
mov    $0x3,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x2c,%edi
mov    $0xe8,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x15,%edi
mov    $0x40,%esi
call   1060 <Write_MFRC522@plt>
mov    $0x11,%edi
mov    $0x3d,%esi
pop    %rax
jmp    1060 <Write_MFRC522@plt>

LLVM IR (-O0):
define void @MFRC522_Init() {
%1 = alloca i8
%2 = call i32 @setrst(i32 0)
%3 = call i32 @bcm2835_delay(i32 50)
%4 = call i32 @setrst(i32 1)
%5 = call i32 @bcm2835_delay(i32 50)
br label %6
6: ; preds = %8, %0
%7 = call zeroext i8 @Read_MFRC522(i32 1)
store i8 %7, i8* %1
br label %8
8: ; preds = %6
%9 = load i8, i8* %1
%10 = zext i8 %9 to i32
%11 = and i32 %10, 1
%12 = icmp ne i32 %11, 0
br i1 %12, label %6, label %13
13: ; preds = %8
%14 = call i32 (...) @AntennaOn()
%15 = call i32 @Write_MFRC522(i32 42, i32 128)
%16 = call i32 @Write_MFRC522(i32 43, i32 169)
%17 = call i32 @Write_MFRC522(i32 45, i32 3)
%18 = call i32 @Write_MFRC522(i32 44, i32 232)
%19 = call i32 @Write_MFRC522(i32 21, i32 64)
%20 = call i32 @Write_MFRC522(i32 17, i32 61)
ret void
}

LLVM IR (-O2):
define void @MFRC522_Init() {
%1 = tail call i32 @setrst(i32 0)
%2 = tail call i32 @bcm2835_delay(i32 50)
%3 = tail call i32 @setrst(i32 1)
%4 = tail call i32 @bcm2835_delay(i32 50)
br label %5
5: ; preds = %5, %0
%6 = tail call zeroext i8 @Read_MFRC522(i32 1)
%7 = and i8 %6, 1
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5
%10 = tail call i32 (...) @AntennaOn()
%11 = tail call i32 @Write_MFRC522(i32 42, i32 128)
%12 = tail call i32 @Write_MFRC522(i32 43, i32 169)
%13 = tail call i32 @Write_MFRC522(i32 45, i32 3)
%14 = tail call i32 @Write_MFRC522(i32 44, i32 232)
%15 = tail call i32 @Write_MFRC522(i32 21, i32 64)
%16 = tail call i32 @Write_MFRC522(i32 17, i32 61)
ret void
}