#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*/ Parport_MonitorStatus(int, int);
scalar_t__ Parport_ReadData(int);
scalar_t__ Parport_ReadStatus(int);
int /*<<< orphan*/ Parport_WriteControl(int, int);
int /*<<< orphan*/ Parport_WriteData(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
void ClosePrinter(int a_Device) {
  Parport_WriteData(a_Device, 0x34);
  usleep(5);
  Parport_WriteControl(a_Device, 0x08);
  usleep(5);
  Parport_WriteControl(a_Device, 0x08);
  usleep(5);
  Parport_WriteControl(a_Device, 0x08);
  usleep(5);
  Parport_WriteControl(a_Device, 0x08);
  usleep(5);
  Parport_WriteControl(a_Device, 0x0C);
  usleep(5);
  fprintf(stderr,
          "hlcapt:ClosePrinter 650  ctrl PortStatus %02X Device data %02X \n",
          (int)Parport_ReadStatus(a_Device), (int)Parport_ReadData(a_Device));
  Parport_MonitorStatus(a_Device, 1000);
}


x86 assembly (clang, -O0):
<ClosePrinter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x34,%esi
call   1040 <Parport_WriteData@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    -0x4(%rbp),%edi
mov    $0xc,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <Parport_ReadStatus@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1080 <Parport_ReadData@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    %eax,%ecx
lea    0xdcd(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x4(%rbp),%edi
mov    $0x3e8,%esi
call   1060 <Parport_MonitorStatus@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClosePrinter>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x34,%esi
call   1040 <Parport_WriteData@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    %ebx,%edi
mov    $0x8,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    %ebx,%edi
mov    $0x8,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    %ebx,%edi
mov    $0x8,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    %ebx,%edi
mov    $0x8,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    %ebx,%edi
mov    $0xc,%esi
call   1030 <Parport_WriteControl@plt>
mov    $0x5,%edi
call   1090 <usleep@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%r14d
mov    %ebx,%edi
call   1070 <Parport_ReadStatus@plt>
mov    %rax,%rbp
mov    %ebx,%edi
call   1080 <Parport_ReadData@plt>
lea    0xde6(%rip),%rsi
mov    %r14d,%edi
mov    %ebp,%edx
mov    %eax,%ecx
call   1050 <fprintf@plt>
mov    %ebx,%edi
mov    $0x3e8,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <Parport_MonitorStatus@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [65 x i8] c"hlcapt:ClosePrinter 650 ctrl PortStatus %02X Device data %02X \0A\00"
define void @ClosePrinter(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @Parport_WriteData(i32 %3, i32 52)
%5 = call i32 @usleep(i32 5)
%6 = load i32, i32* %2
%7 = call i32 @Parport_WriteControl(i32 %6, i32 8)
%8 = call i32 @usleep(i32 5)
%9 = load i32, i32* %2
%10 = call i32 @Parport_WriteControl(i32 %9, i32 8)
%11 = call i32 @usleep(i32 5)
%12 = load i32, i32* %2
%13 = call i32 @Parport_WriteControl(i32 %12, i32 8)
%14 = call i32 @usleep(i32 5)
%15 = load i32, i32* %2
%16 = call i32 @Parport_WriteControl(i32 %15, i32 8)
%17 = call i32 @usleep(i32 5)
%18 = load i32, i32* %2
%19 = call i32 @Parport_WriteControl(i32 %18, i32 12)
%20 = call i32 @usleep(i32 5)
%21 = load i32, i32* @stderr
%22 = load i32, i32* %2
%23 = call i64 @Parport_ReadStatus(i32 %22)
%24 = trunc i64 %23 to i32
%25 = load i32, i32* %2
%26 = call i64 @Parport_ReadData(i32 %25)
%27 = trunc i64 %26 to i32
%28 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %27)
%29 = load i32, i32* %2
%30 = call i32 @Parport_MonitorStatus(i32 %29, i32 1000)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [65 x i8] c"hlcapt:ClosePrinter 650 ctrl PortStatus %02X Device data %02X \0A\00"
define void @ClosePrinter(i32 %0) {
%2 = tail call i32 @Parport_WriteData(i32 %0, i32 52)
%3 = tail call i32 @usleep(i32 5)
%4 = tail call i32 @Parport_WriteControl(i32 %0, i32 8)
%5 = tail call i32 @usleep(i32 5)
%6 = tail call i32 @Parport_WriteControl(i32 %0, i32 8)
%7 = tail call i32 @usleep(i32 5)
%8 = tail call i32 @Parport_WriteControl(i32 %0, i32 8)
%9 = tail call i32 @usleep(i32 5)
%10 = tail call i32 @Parport_WriteControl(i32 %0, i32 8)
%11 = tail call i32 @usleep(i32 5)
%12 = tail call i32 @Parport_WriteControl(i32 %0, i32 12)
%13 = tail call i32 @usleep(i32 5)
%14 = load i32, i32* @stderr
%15 = tail call i64 @Parport_ReadStatus(i32 %0)
%16 = trunc i64 %15 to i32
%17 = tail call i64 @Parport_ReadData(i32 %0)
%18 = trunc i64 %17 to i32
%19 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18)
%20 = tail call i32 @Parport_MonitorStatus(i32 %0, i32 1000)
ret void
}