#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*/ uart_putc(unsigned char volatile);
void uart_read_poll() {
  int uartread = 10;
  while (uartread--) {
    if ((*(volatile unsigned char *)(0xffff8c)) & (1 << 6)) {
      uart_putc((*(volatile unsigned char *)(0xffff8d)));
      (*(volatile unsigned char *)(0xffff8c)) &=
          ~((1 << 5) | (1 << 4) | (1 << 3) | (1 << 6));
    }
  }
}


x86 assembly (clang, -O0):
<uart_read_poll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1173 <uart_read_poll+0x63>
mov    $0xffff8c,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     116e <uart_read_poll+0x5e>
mov    $0xffff8d,%eax
mov    (%rax),%al
movzbl %al,%edi
call   1030 <uart_putc@plt>
mov    $0xffff8c,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0xffffff87,%eax
mov    %al,%cl
mov    $0xffff8c,%eax
mov    %cl,(%rax)
jmp    111f <uart_read_poll+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_read_poll>:
push   %rax
testb  $0x40,0xffff8c
40
jne    119f <uart_read_poll+0x8f>
testb  $0x40,0xffff8c
40
jne    11c2 <uart_read_poll+0xb2>
testb  $0x40,0xffff8c
40
jne    11e5 <uart_read_poll+0xd5>
testb  $0x40,0xffff8c
40
jne    1208 <uart_read_poll+0xf8>
testb  $0x40,0xffff8c
40
jne    122b <uart_read_poll+0x11b>
testb  $0x40,0xffff8c
40
jne    124e <uart_read_poll+0x13e>
testb  $0x40,0xffff8c
40
jne    1271 <uart_read_poll+0x161>
testb  $0x40,0xffff8c
40
jne    1294 <uart_read_poll+0x184>
testb  $0x40,0xffff8c
40
jne    12b7 <uart_read_poll+0x1a7>
testb  $0x40,0xffff8c
40
jne    12da <uart_read_poll+0x1ca>
pop    %rax
ret
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
testb  $0x40,0xffff8c
40
je     112d <uart_read_poll+0x1d>
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
testb  $0x40,0xffff8c
40
je     113b <uart_read_poll+0x2b>
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
testb  $0x40,0xffff8c
40
je     1149 <uart_read_poll+0x39>
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
testb  $0x40,0xffff8c
40
je     1157 <uart_read_poll+0x47>
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
testb  $0x40,0xffff8c
40
je     1165 <uart_read_poll+0x55>
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
testb  $0x40,0xffff8c
40
je     1173 <uart_read_poll+0x63>
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
testb  $0x40,0xffff8c
40
je     1181 <uart_read_poll+0x71>
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
testb  $0x40,0xffff8c
40
je     118f <uart_read_poll+0x7f>
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
testb  $0x40,0xffff8c
40
je     119d <uart_read_poll+0x8d>
movzbl 0xffff8d,%edi
call   1030 <uart_putc@plt>
andb   $0x87,0xffff8c
87
pop    %rax
ret

LLVM IR (-O0):
define void @uart_read_poll() {
%1 = alloca i32
store i32 10, i32* %1
br label %2
2: ; preds = %18, %0
%3 = load i32, i32* %1
%4 = add nsw i32 %3, -1
store i32 %4, i32* %1
%5 = icmp ne i32 %3, 0
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%8 = zext i8 %7 to i32
%9 = and i32 %8, 64
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %6
%12 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%13 = call i32 @uart_putc(i8 zeroext %12)
%14 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%15 = zext i8 %14 to i32
%16 = and i32 %15, -121
%17 = trunc i32 %16 to i8
store volatile i8 %17, i8* inttoptr (i64 16777100 to i8*)
br label %18
18: ; preds = %11, %6
br label %2
19: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @uart_read_poll() {
%1 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%2 = and i8 %1, 64
%3 = icmp eq i8 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %0
%5 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%6 = tail call i32 @uart_putc(i8 zeroext %5)
%7 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%8 = and i8 %7, -121
store volatile i8 %8, i8* inttoptr (i64 16777100 to i8*)
br label %9
9: ; preds = %4, %0
%10 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%11 = and i8 %10, 64
%12 = icmp eq i8 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %9
%14 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%15 = tail call i32 @uart_putc(i8 zeroext %14)
%16 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%17 = and i8 %16, -121
store volatile i8 %17, i8* inttoptr (i64 16777100 to i8*)
br label %18
18: ; preds = %13, %9
%19 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%20 = and i8 %19, 64
%21 = icmp eq i8 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %18
%23 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%24 = tail call i32 @uart_putc(i8 zeroext %23)
%25 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%26 = and i8 %25, -121
store volatile i8 %26, i8* inttoptr (i64 16777100 to i8*)
br label %27
27: ; preds = %22, %18
%28 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%29 = and i8 %28, 64
%30 = icmp eq i8 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %27
%32 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%33 = tail call i32 @uart_putc(i8 zeroext %32)
%34 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%35 = and i8 %34, -121
store volatile i8 %35, i8* inttoptr (i64 16777100 to i8*)
br label %36
36: ; preds = %31, %27
%37 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%38 = and i8 %37, 64
%39 = icmp eq i8 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %36
%41 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%42 = tail call i32 @uart_putc(i8 zeroext %41)
%43 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%44 = and i8 %43, -121
store volatile i8 %44, i8* inttoptr (i64 16777100 to i8*)
br label %45
45: ; preds = %40, %36
%46 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%47 = and i8 %46, 64
%48 = icmp eq i8 %47, 0
br i1 %48, label %54, label %49
49: ; preds = %45
%50 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%51 = tail call i32 @uart_putc(i8 zeroext %50)
%52 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%53 = and i8 %52, -121
store volatile i8 %53, i8* inttoptr (i64 16777100 to i8*)
br label %54
54: ; preds = %49, %45
%55 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%56 = and i8 %55, 64
%57 = icmp eq i8 %56, 0
br i1 %57, label %63, label %58
58: ; preds = %54
%59 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%60 = tail call i32 @uart_putc(i8 zeroext %59)
%61 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%62 = and i8 %61, -121
store volatile i8 %62, i8* inttoptr (i64 16777100 to i8*)
br label %63
63: ; preds = %58, %54
%64 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%65 = and i8 %64, 64
%66 = icmp eq i8 %65, 0
br i1 %66, label %72, label %67
67: ; preds = %63
%68 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%69 = tail call i32 @uart_putc(i8 zeroext %68)
%70 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%71 = and i8 %70, -121
store volatile i8 %71, i8* inttoptr (i64 16777100 to i8*)
br label %72
72: ; preds = %67, %63
%73 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%74 = and i8 %73, 64
%75 = icmp eq i8 %74, 0
br i1 %75, label %81, label %76
76: ; preds = %72
%77 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%78 = tail call i32 @uart_putc(i8 zeroext %77)
%79 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%80 = and i8 %79, -121
store volatile i8 %80, i8* inttoptr (i64 16777100 to i8*)
br label %81
81: ; preds = %76, %72
%82 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%83 = and i8 %82, 64
%84 = icmp eq i8 %83, 0
br i1 %84, label %90, label %85
85: ; preds = %81
%86 = load volatile i8, i8* inttoptr (i64 16777101 to i8*)
%87 = tail call i32 @uart_putc(i8 zeroext %86)
%88 = load volatile i8, i8* inttoptr (i64 16777100 to i8*)
%89 = and i8 %88, -121
store volatile i8 %89, i8* inttoptr (i64 16777100 to i8*)
br label %90
90: ; preds = %85, %81
ret void
}