#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 char uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
void uart_put_onechar_boot_phase(uint8_t c) {
  while ((*(volatile uint32_t *)0xA00C0028) == 0)
    ;
  *(volatile uint32_t *)0xA00C0004 = c;
  if (c != '\n')
    return;
  while ((*(volatile uint32_t *)0xA00C0028) == 0)
    ;
  *(volatile uint32_t *)0xA00C0004 = '\r';
  while ((*(volatile uint32_t *)0xA00C0028) == 0)
    ;
}


x86 assembly (clang, -O0):
<uart_put_onechar_boot_phase>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xa00c0028,%eax
mov    (%rax),%rax
cmp    $0x0,%rax
jne    1121 <uart_put_onechar_boot_phase+0x21>
jmp    110a <uart_put_onechar_boot_phase+0xa>
movsbq -0x1(%rbp),%rcx
mov    $0xa00c0004,%eax
mov    %rcx,(%rax)
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
je     1140 <uart_put_onechar_boot_phase+0x40>
jmp    117f <uart_put_onechar_boot_phase+0x7f>
jmp    1145 <uart_put_onechar_boot_phase+0x45>
mov    $0xa00c0028,%eax
mov    (%rax),%rax
cmp    $0x0,%rax
jne    115c <uart_put_onechar_boot_phase+0x5c>
jmp    1145 <uart_put_onechar_boot_phase+0x45>
mov    $0xa00c0004,%eax
movq   $0xd,(%rax)
mov    $0xa00c0028,%eax
mov    (%rax),%rax
cmp    $0x0,%rax
jne    117f <uart_put_onechar_boot_phase+0x7f>
jmp    1168 <uart_put_onechar_boot_phase+0x68>
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_put_onechar_boot_phase>:
mov    $0xa00c0028,%eax
cs nopw 0x0(%rax,%rax,1)
nop
cmpq   $0x0,(%rax)
je     1110 <uart_put_onechar_boot_phase+0x10>
movsbq %dil,%rcx
mov    %rcx,-0x24(%rax)
cmp    $0xa,%cl
jne    1146 <uart_put_onechar_boot_phase+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpq   $0x0,(%rax)
je     1130 <uart_put_onechar_boot_phase+0x30>
movq   $0xd,-0x24(%rax)
xchg   %ax,%ax
cmpq   $0x0,(%rax)
je     1140 <uart_put_onechar_boot_phase+0x40>
ret

LLVM IR (-O0):
define void @uart_put_onechar_boot_phase(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %6, %1
%4 = load volatile i64, i64* inttoptr (i64 2685141032 to i64*)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %3
br label %3
7: ; preds = %3
%8 = load i8, i8* %2
%9 = sext i8 %8 to i64
store volatile i64 %9, i64* inttoptr (i64 2685140996 to i64*)
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %7
br label %24
14: ; preds = %7
br label %15
15: ; preds = %18, %14
%16 = load volatile i64, i64* inttoptr (i64 2685141032 to i64*)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %15
19: ; preds = %15
store volatile i64 13, i64* inttoptr (i64 2685140996 to i64*)
br label %20
20: ; preds = %23, %19
%21 = load volatile i64, i64* inttoptr (i64 2685141032 to i64*)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
br label %20
24: ; preds = %13, %20
ret void
}

LLVM IR (-O2):
define void @uart_put_onechar_boot_phase(i8 signext %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i64, i64* inttoptr (i64 2685141032 to i64*)
%4 = icmp eq i64 %3, 0
br i1 %4, label %2, label %5
5: ; preds = %2
%6 = sext i8 %0 to i64
store volatile i64 %6, i64* inttoptr (i64 2685140996 to i64*)
%7 = icmp eq i8 %0, 10
br i1 %7, label %8, label %15
8: ; preds = %5, %8
%9 = load volatile i64, i64* inttoptr (i64 2685141032 to i64*)
%10 = icmp eq i64 %9, 0
br i1 %10, label %8, label %11
11: ; preds = %8
store volatile i64 13, i64* inttoptr (i64 2685140996 to i64*)
br label %12
12: ; preds = %12, %11
%13 = load volatile i64, i64* inttoptr (i64 2685141032 to i64*)
%14 = icmp eq i64 %13, 0
br i1 %14, label %12, label %15
15: ; preds = %12, %5
ret void
}