#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 USBNRead(int);
int /*<<< orphan*/ USBNWrite(int, int);
int /*<<< orphan*/ _USBNInitEP0();
void USBNStart(void) {
  _USBNInitEP0();
  USBNWrite(0x00, 0x01);
  while (USBNRead(0x00) & 0x01)
    ;
  USBNWrite(0x01, 0x02);
  USBNWrite(0x0F, 0x10);
  USBNWrite(0x04, 0x80 + 0x00);
  USBNWrite(0x20, 0x40);
  USBNWrite(0x23, 0x08);
  USBNWrite(0x27, 0x01 + 0x08);
  USBNWrite(0x0D, 0x01 + 0x02 + 0x04 + 0x08);
  USBNWrite(0x0B, 0x01 + 0x02 + 0x04 + 0x08);
  USBNWrite(0x09, 0x40 + 0x10);
  USBNWrite(0x07, (0x80 + 0x40 + 0x02 + 0x04 + 0x10));
  USBNWrite(0x05, 0x02);
  USBNWrite(0x00, 0x04 + 0x08 + 0xC0);
  return;
}


x86 assembly (clang, -O0):
<USBNStart>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <_USBNInitEP0@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <USBNWrite@plt>
xor    %edi,%edi
call   1030 <USBNRead@plt>
and    $0x1,%eax
cmp    $0x0,%eax
je     115f <USBNStart+0x2f>
jmp    1147 <USBNStart+0x17>
mov    $0x1,%edi
mov    $0x2,%esi
call   1050 <USBNWrite@plt>
mov    $0xf,%edi
mov    $0x10,%esi
call   1050 <USBNWrite@plt>
mov    $0x4,%edi
mov    $0x80,%esi
call   1050 <USBNWrite@plt>
mov    $0x20,%edi
mov    $0x40,%esi
call   1050 <USBNWrite@plt>
mov    $0x23,%edi
mov    $0x8,%esi
call   1050 <USBNWrite@plt>
mov    $0x27,%edi
mov    $0x9,%esi
call   1050 <USBNWrite@plt>
mov    $0xd,%edi
mov    $0xf,%esi
call   1050 <USBNWrite@plt>
mov    $0xb,%edi
mov    $0xf,%esi
call   1050 <USBNWrite@plt>
mov    $0x9,%edi
mov    $0x50,%esi
call   1050 <USBNWrite@plt>
mov    $0x7,%edi
mov    $0xd6,%esi
call   1050 <USBNWrite@plt>
mov    $0x5,%edi
mov    $0x2,%esi
call   1050 <USBNWrite@plt>
xor    %edi,%edi
mov    $0xcc,%esi
call   1050 <USBNWrite@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBNStart>:
push   %rax
xor    %eax,%eax
call   1040 <_USBNInitEP0@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <USBNWrite@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edi,%edi
call   1030 <USBNRead@plt>
test   $0x1,%al
jne    1150 <USBNStart+0x20>
mov    $0x1,%edi
mov    $0x2,%esi
call   1050 <USBNWrite@plt>
mov    $0xf,%edi
mov    $0x10,%esi
call   1050 <USBNWrite@plt>
mov    $0x4,%edi
mov    $0x80,%esi
call   1050 <USBNWrite@plt>
mov    $0x20,%edi
mov    $0x40,%esi
call   1050 <USBNWrite@plt>
mov    $0x23,%edi
mov    $0x8,%esi
call   1050 <USBNWrite@plt>
mov    $0x27,%edi
mov    $0x9,%esi
call   1050 <USBNWrite@plt>
mov    $0xd,%edi
mov    $0xf,%esi
call   1050 <USBNWrite@plt>
mov    $0xb,%edi
mov    $0xf,%esi
call   1050 <USBNWrite@plt>
mov    $0x9,%edi
mov    $0x50,%esi
call   1050 <USBNWrite@plt>
mov    $0x7,%edi
mov    $0xd6,%esi
call   1050 <USBNWrite@plt>
mov    $0x5,%edi
mov    $0x2,%esi
call   1050 <USBNWrite@plt>
xor    %edi,%edi
mov    $0xcc,%esi
pop    %rax
jmp    1050 <USBNWrite@plt>

LLVM IR (-O0):
define void @USBNStart() {
%1 = call i32 (...) @_USBNInitEP0()
%2 = call i32 @USBNWrite(i32 0, i32 1)
br label %3
3: ; preds = %7, %0
%4 = call i32 @USBNRead(i32 0)
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = call i32 @USBNWrite(i32 1, i32 2)
%10 = call i32 @USBNWrite(i32 15, i32 16)
%11 = call i32 @USBNWrite(i32 4, i32 128)
%12 = call i32 @USBNWrite(i32 32, i32 64)
%13 = call i32 @USBNWrite(i32 35, i32 8)
%14 = call i32 @USBNWrite(i32 39, i32 9)
%15 = call i32 @USBNWrite(i32 13, i32 15)
%16 = call i32 @USBNWrite(i32 11, i32 15)
%17 = call i32 @USBNWrite(i32 9, i32 80)
%18 = call i32 @USBNWrite(i32 7, i32 214)
%19 = call i32 @USBNWrite(i32 5, i32 2)
%20 = call i32 @USBNWrite(i32 0, i32 204)
ret void
}

LLVM IR (-O2):
define void @USBNStart() {
%1 = tail call i32 (...) @_USBNInitEP0()
%2 = tail call i32 @USBNWrite(i32 0, i32 1)
br label %3
3: ; preds = %3, %0
%4 = tail call i32 @USBNRead(i32 0)
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3
%8 = tail call i32 @USBNWrite(i32 1, i32 2)
%9 = tail call i32 @USBNWrite(i32 15, i32 16)
%10 = tail call i32 @USBNWrite(i32 4, i32 128)
%11 = tail call i32 @USBNWrite(i32 32, i32 64)
%12 = tail call i32 @USBNWrite(i32 35, i32 8)
%13 = tail call i32 @USBNWrite(i32 39, i32 9)
%14 = tail call i32 @USBNWrite(i32 13, i32 15)
%15 = tail call i32 @USBNWrite(i32 11, i32 15)
%16 = tail call i32 @USBNWrite(i32 9, i32 80)
%17 = tail call i32 @USBNWrite(i32 7, i32 214)
%18 = tail call i32 @USBNWrite(i32 5, i32 2)
%19 = tail call i32 @USBNWrite(i32 0, i32 204)
ret void
}