#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 Parport_ReadStatus(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void Parport_MonitorStatus(int a_dDevice, int a_dCounter) {
  int dIndex = 0;
  int bCurrentStatus = 0;
  int bPrevStatus = 0;
  for (dIndex = 0; dIndex < a_dCounter; dIndex++) {
    bCurrentStatus = Parport_ReadStatus(a_dDevice);
    if (bPrevStatus != bCurrentStatus) {
      bPrevStatus = bCurrentStatus;
      fprintf(stderr, "pport:Parport_MonitorStatus 30 PortStatus %02X %d\n",
              (int)bPrevStatus, dIndex);
    }
  }
  fprintf(stderr, "pport:Parport_MonitorStatus 999 \n \n");
}


x86 assembly (clang, -O0):
<Parport_MonitorStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a3 <Parport_MonitorStatus+0x83>
mov    -0x4(%rbp),%edi
call   1040 <Parport_ReadStatus@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1190 <Parport_MonitorStatus+0x70>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe77(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1195 <Parport_MonitorStatus+0x75>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <Parport_MonitorStatus+0x2a>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Parport_MonitorStatus>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1183 <Parport_MonitorStatus+0x63>
mov    %esi,%r12d
mov    %edi,%r15d
lea    0xec4(%rip),%r14
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    1158 <Parport_MonitorStatus+0x38>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
cmp    %ebp,%r12d
je     1183 <Parport_MonitorStatus+0x63>
mov    %r15d,%edi
call   1040 <Parport_ReadStatus@plt>
cmp    %eax,%r13d
je     1150 <Parport_MonitorStatus+0x30>
mov    %eax,%ebx
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %ebx,%r13d
jmp    1150 <Parport_MonitorStatus+0x30>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"pport:Parport_MonitorStatus 30 PortStatus %02X %d\0A\00"
@.str.1 = [36 x i8] c"pport:Parport_MonitorStatus 999 \0A \0A\00"
define void @Parport_MonitorStatus(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %5
br label %8
8: ; preds = %25, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %28
12: ; preds = %8
%13 = load i32, i32* %3
%14 = call i32 @Parport_ReadStatus(i32 %13)
store i32 %14, i32* %6
%15 = load i32, i32* %7
%16 = load i32, i32* %6
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %12
%19 = load i32, i32* %6
store i32 %19, i32* %7
%20 = load i32, i32* @stderr
%21 = load i32, i32* %7
%22 = load i32, i32* %5
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22)
br label %24
24: ; preds = %18, %12
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %8
28: ; preds = %8
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"pport:Parport_MonitorStatus 30 PortStatus %02X %d\0A\00"
@.str.1 = [36 x i8] c"pport:Parport_MonitorStatus 999 \0A \0A\00"
define void @Parport_MonitorStatus(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %16
4: ; preds = %2, %12
%5 = phi i32 [ %13, %12 ], [ 0, %2 ]
%6 = phi i32 [ %14, %12 ], [ 0, %2 ]
%7 = tail call i32 @Parport_ReadStatus(i32 %0)
%8 = icmp eq i32 %5, %7
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %6)
br label %12
12: ; preds = %4, %9
%13 = phi i32 [ %7, %9 ], [ %5, %4 ]
%14 = add nuw nsw i32 %6, 1
%15 = icmp eq i32 %14, %1
br i1 %15, label %16, label %4
16: ; preds = %12, %2
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
ret void
}