#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ BusyWait(int);
scalar_t__ getpin();
int /*<<< orphan*/ setpin0();
int /*<<< orphan*/ setpinhiz();
uint32_t xferbit(uint32_t thebit) {
  setpin0();
  BusyWait(((uint32_t)(((((double)1.5 * (double)(5 * 11059200)) /
                         ((double)(7) * 1000.0f * 1000.0f))) +
                       0.5f)));
  if (thebit)
    setpinhiz();
  thebit = 0;
  BusyWait(((uint32_t)(((((double)13 * (double)(5 * 11059200)) /
                         ((double)(7) * 1000.0f * 1000.0f))) +
                       0.5f)));
  if (getpin())
    thebit = 0x01;
  BusyWait(((uint32_t)(((((double)45 * (double)(5 * 11059200)) /
                         ((double)(7) * 1000.0f * 1000.0f))) +
                       0.5f)));
  setpinhiz();
  BusyWait(((uint32_t)(((((double)10 * (double)(5 * 11059200)) /
                         ((double)(7) * 1000.0f * 1000.0f))) +
                       0.5f)));
  return thebit;
}


x86 assembly (clang, -O0):
<xferbit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <setpin0@plt>
mov    $0xc,%edi
call   1040 <BusyWait@plt>
cmpl   $0x0,-0x4(%rbp)
je     116d <xferbit+0x2d>
mov    $0x0,%al
call   1050 <setpinhiz@plt>
movl   $0x0,-0x4(%rbp)
mov    $0x67,%edi
call   1040 <BusyWait@plt>
mov    $0x0,%al
call   1060 <getpin@plt>
cmp    $0x0,%rax
je     1196 <xferbit+0x56>
movl   $0x1,-0x4(%rbp)
mov    $0x163,%edi
call   1040 <BusyWait@plt>
mov    $0x0,%al
call   1050 <setpinhiz@plt>
mov    $0x4f,%edi
call   1040 <BusyWait@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xferbit>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <setpin0@plt>
mov    $0xc,%edi
call   1040 <BusyWait@plt>
test   %ebx,%ebx
je     115f <xferbit+0x1f>
xor    %eax,%eax
call   1050 <setpinhiz@plt>
mov    $0x67,%edi
call   1040 <BusyWait@plt>
xor    %eax,%eax
call   1060 <getpin@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    $0x163,%edi
call   1040 <BusyWait@plt>
xor    %eax,%eax
call   1050 <setpinhiz@plt>
mov    $0x4f,%edi
call   1040 <BusyWait@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @xferbit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @setpin0()
%4 = call i32 @BusyWait(i32 12)
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @setpinhiz()
br label %9
9: ; preds = %7, %1
store i32 0, i32* %2
%10 = call i32 @BusyWait(i32 103)
%11 = call i64 (...) @getpin()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 1, i32* %2
br label %14
14: ; preds = %13, %9
%15 = call i32 @BusyWait(i32 355)
%16 = call i32 (...) @setpinhiz()
%17 = call i32 @BusyWait(i32 79)
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @xferbit(i32 %0) {
%2 = tail call i32 (...) @setpin0()
%3 = tail call i32 @BusyWait(i32 12)
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @setpinhiz()
br label %7
7: ; preds = %5, %1
%8 = tail call i32 @BusyWait(i32 103)
%9 = tail call i64 (...) @getpin()
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @BusyWait(i32 355)
%13 = tail call i32 (...) @setpinhiz()
%14 = tail call i32 @BusyWait(i32 79)
ret i32 %11
}